-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Artur Bien
committed
Nov 29, 2020
1 parent
e4dc63d
commit a08f2e0
Showing
10 changed files
with
283 additions
and
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { useState } from 'react'; | ||
import { StyleSheet } from 'react-native'; | ||
import { Radio, Panel, Fieldset } from 'react95-native'; | ||
|
||
const CheckboxExample = () => { | ||
const [value, setValue] = useState('Apple'); | ||
|
||
return ( | ||
<Panel style={styles.container}> | ||
<Fieldset label='Default'> | ||
<Radio | ||
status={value === 'Apple' ? 'checked' : 'unchecked'} | ||
onPress={() => setValue('Apple')} | ||
label='Apple' | ||
/> | ||
<Radio | ||
status={value === 'Orange' ? 'checked' : 'unchecked'} | ||
onPress={() => setValue('Orange')} | ||
label='Orange' | ||
/> | ||
<Radio | ||
status={value === 'Watermelon' ? 'checked' : 'unchecked'} | ||
onPress={() => setValue('Watermelon')} | ||
label='Watermelon' | ||
/> | ||
</Fieldset> | ||
<Fieldset label='Disabled'> | ||
<Radio | ||
status='checked' | ||
onPress={() => console.warn('pressed')} | ||
label='Apple' | ||
disabled | ||
/> | ||
<Radio | ||
status='unchecked' | ||
onPress={() => console.warn('pressed')} | ||
label='Pear' | ||
disabled | ||
/> | ||
</Fieldset> | ||
</Panel> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
padding: 16, | ||
}, | ||
}); | ||
|
||
export default CheckboxExample; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { StyleProp, ViewStyle } from 'react-native'; | ||
import SwitchBase from '../SwitchBase'; | ||
|
||
type Props = { | ||
disabled?: boolean; | ||
label?: string; | ||
onPress?: () => void; | ||
status: 'checked' | 'unchecked'; | ||
style?: StyleProp<ViewStyle>; | ||
}; | ||
|
||
const Radio = ({ | ||
disabled = false, | ||
label = '', | ||
onPress = () => {}, | ||
status, | ||
style = {}, | ||
}: Props) => { | ||
return ( | ||
<SwitchBase | ||
component='radio' | ||
disabled={disabled} | ||
label={label} | ||
onPress={onPress} | ||
status={status} | ||
style={style} | ||
/> | ||
); | ||
}; | ||
|
||
export default Radio; |
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 @@ | ||
export { default } from './Radio'; |
Oops, something went wrong.