-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sample): merge ios and android samples (#3015)
* chore: split components
- Loading branch information
Showing
7 changed files
with
454 additions
and
846 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
examples/basic/ios/videoplayer.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
StyleSheet, | ||
Text, | ||
TextStyle, | ||
TouchableOpacity, | ||
View, | ||
} from 'react-native'; | ||
|
||
/* | ||
* MultiValueControl displays a list clickable text view | ||
*/ | ||
|
||
interface MultiValueControlType { | ||
// a list a string or number to be displayed | ||
values: Array<string | number> | ||
// The selected value in values | ||
selected?: string | number | ||
// callback to press onPress | ||
onPress: (arg: string | number) => any | ||
} | ||
|
||
const MultiValueControl = ({ values, selected, onPress }: MultiValueControlType) => { | ||
const selectedStyle: TextStyle = StyleSheet.flatten([ | ||
styles.option, | ||
{fontWeight: 'bold'}, | ||
]); | ||
|
||
const unselectedStyle: TextStyle = StyleSheet.flatten([ | ||
styles.option, | ||
{fontWeight: 'normal'}, | ||
]); | ||
|
||
return <View style={styles.container}> | ||
{values.map((value: string | number) => { | ||
const _style = value === selected ? selectedStyle : unselectedStyle | ||
return ( | ||
<TouchableOpacity | ||
key={value} | ||
onPress={() => { | ||
onPress?.(value) | ||
}}> | ||
<Text style={_style}>{value}</Text> | ||
</TouchableOpacity>) | ||
})} | ||
</View> | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
option: { | ||
alignSelf: 'center', | ||
fontSize: 11, | ||
color: 'white', | ||
paddingLeft: 2, | ||
paddingRight: 2, | ||
lineHeight: 12, | ||
}, | ||
container: { | ||
flex: 1, | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
}); | ||
|
||
export default MultiValueControl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
StyleSheet, | ||
Text, | ||
TextStyle, | ||
TouchableOpacity, | ||
View, | ||
} from 'react-native'; | ||
|
||
/* | ||
* ToggleControl displays a 2 states clickable text | ||
*/ | ||
|
||
interface ToggleControlType { | ||
// boolean indicating if text is selected state | ||
isSelected?: boolean | ||
// value of text when selected | ||
selectedText?: string | ||
// value of text when NOT selected | ||
unselectedText?: string | ||
// default text if no only one text field is needed | ||
text?: string | ||
// callback called when pressing the component | ||
onPress: () => any | ||
} | ||
|
||
const ToggleControl = ({ isSelected, selectedText, unselectedText, text, onPress }: ToggleControlType) => { | ||
const selectedStyle: TextStyle = StyleSheet.flatten([ | ||
styles.controlOption, | ||
{fontWeight: 'bold'}, | ||
]); | ||
|
||
const unselectedStyle: TextStyle = StyleSheet.flatten([ | ||
styles.controlOption, | ||
{fontWeight: 'normal'}, | ||
]); | ||
|
||
const style = isSelected ? selectedStyle : unselectedStyle; | ||
const _text = text ? text : isSelected ? selectedText : unselectedText; | ||
return ( | ||
<View style={styles.resizeModeControl}> | ||
<TouchableOpacity | ||
onPress={onPress}> | ||
<Text style={style}>{_text}</Text> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
controlOption: { | ||
alignSelf: 'center', | ||
fontSize: 11, | ||
color: 'white', | ||
paddingLeft: 2, | ||
paddingRight: 2, | ||
lineHeight: 12, | ||
}, | ||
resizeModeControl: { | ||
flex: 1, | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
}); | ||
|
||
export default ToggleControl; |
Oops, something went wrong.
Is there any reason to downgrade?