forked from keep-starknet-strange/joyboy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into scripts/escrow_tip
- Loading branch information
Showing
7 changed files
with
9,974 additions
and
10,500 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {Picker as RNPicker, PickerProps as RNPickerProps} from '@react-native-picker/picker'; | ||
import {forwardRef} from 'react'; | ||
|
||
import {useStyles} from '../../hooks'; | ||
import {PickerContainer} from '../PickerContainer'; | ||
import stylesheet from './styles'; | ||
|
||
export type PickerProps = RNPickerProps<string> & { | ||
label: string; | ||
}; | ||
|
||
export const _Picker = forwardRef<RNPicker<string>, PickerProps>((props, ref) => { | ||
const {label, selectedValue, children, ...restProps} = props; | ||
|
||
const styles = useStyles(stylesheet); | ||
|
||
return ( | ||
<PickerContainer | ||
selectedValue={selectedValue} | ||
modalizeTitle={label} | ||
containerStyle={styles.container} | ||
textProps={{fontSize: 15, weight: 'semiBold', color: 'inputText'}} | ||
> | ||
<RNPicker ref={ref} selectedValue={selectedValue} {...restProps}> | ||
{children} | ||
</RNPicker> | ||
</PickerContainer> | ||
); | ||
}); | ||
_Picker.displayName = 'Picker'; | ||
|
||
const Picker = _Picker as typeof _Picker & {Item: typeof RNPicker.Item}; | ||
Picker.Item = RNPicker.Item; | ||
|
||
export {Picker}; |
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,14 @@ | ||
import {Platform} from 'react-native'; | ||
|
||
import {Spacing, ThemedStyleSheet} from '../../styles'; | ||
|
||
export default ThemedStyleSheet((theme) => ({ | ||
container: { | ||
paddingVertical: Platform.OS === 'android' ? Spacing.none : Spacing.medium, | ||
paddingHorizontal: Platform.OS === 'android' ? Spacing.medium : Spacing.large, | ||
borderWidth: 1, | ||
borderColor: theme.colors.inputBorder, | ||
backgroundColor: theme.colors.inputBackground, | ||
borderRadius: 99, | ||
}, | ||
})); |
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,47 @@ | ||
import {useRef} from 'react'; | ||
import {Platform, Pressable, StyleProp, View, ViewStyle} from 'react-native'; | ||
import {Portal} from 'react-native-portalize'; | ||
|
||
import {Modalize} from '../Modalize'; | ||
import {Text, TextProps} from '../Text'; | ||
|
||
export type PickerContainerProps = { | ||
selectedValue: string; | ||
modalizeTitle: string; | ||
|
||
style?: StyleProp<ViewStyle>; | ||
containerStyle?: StyleProp<ViewStyle>; | ||
textProps?: TextProps; | ||
|
||
children?: React.ReactNode; | ||
}; | ||
|
||
export const PickerContainer: React.FC<PickerContainerProps> = (props) => { | ||
const {selectedValue, modalizeTitle, style, containerStyle, textProps, children} = props; | ||
|
||
const modalizeRef = useRef<Modalize>(null); | ||
|
||
const onTouchablePress = () => { | ||
modalizeRef.current?.open(); | ||
}; | ||
|
||
return ( | ||
<View style={containerStyle}> | ||
{Platform.OS === 'ios' ? ( | ||
<> | ||
<Pressable style={style} onPress={onTouchablePress}> | ||
<Text {...textProps}>{selectedValue}</Text> | ||
</Pressable> | ||
|
||
<Portal> | ||
<Modalize ref={modalizeRef} title={modalizeTitle}> | ||
{children} | ||
</Modalize> | ||
</Portal> | ||
</> | ||
) : ( | ||
children | ||
)} | ||
</View> | ||
); | ||
}; |
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
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
Oops, something went wrong.