11import * as React from 'react' ;
22import { StyleSheet , View } from 'react-native' ;
33
4- import {
5- Checkbox ,
6- MD2Colors ,
7- MD3Colors ,
8- Paragraph ,
9- Text ,
10- TouchableRipple ,
11- } from 'react-native-paper' ;
4+ import { Checkbox , MD3Colors , Text , TouchableRipple } from 'react-native-paper' ;
125
13- import { useExampleTheme } from '../hooks/useExampleTheme' ;
146import ScreenWrapper from '../ScreenWrapper' ;
157
168const CheckboxExample = ( ) => {
179 const [ checkedNormal , setCheckedNormal ] = React . useState < boolean > ( true ) ;
1810 const [ checkedCustom , setCheckedCustom ] = React . useState < boolean > ( true ) ;
1911 const [ indeterminate , setIndeterminate ] = React . useState < boolean > ( true ) ;
2012
21- const { isV3 } = useExampleTheme ( ) ;
22- const TextComponent = isV3 ? Text : Paragraph ;
23-
2413 return (
2514 < ScreenWrapper style = { styles . container } >
2615 < TouchableRipple onPress = { ( ) => setCheckedNormal ( ! checkedNormal ) } >
2716 < View style = { styles . row } >
28- < TextComponent > Normal</ TextComponent >
17+ < Text > Normal</ Text >
2918 < View pointerEvents = "none" >
3019 < Checkbox status = { checkedNormal ? 'checked' : 'unchecked' } />
3120 </ View >
@@ -34,10 +23,10 @@ const CheckboxExample = () => {
3423
3524 < TouchableRipple onPress = { ( ) => setCheckedCustom ( ! checkedCustom ) } >
3625 < View style = { styles . row } >
37- < TextComponent > Custom</ TextComponent >
26+ < Text > Custom</ Text >
3827 < View pointerEvents = "none" >
3928 < Checkbox
40- color = { isV3 ? MD3Colors . error70 : MD2Colors . blue500 }
29+ color = { MD3Colors . error70 }
4130 status = { checkedCustom ? 'checked' : 'unchecked' }
4231 />
4332 </ View >
@@ -46,23 +35,23 @@ const CheckboxExample = () => {
4635
4736 < TouchableRipple onPress = { ( ) => setIndeterminate ( ! indeterminate ) } >
4837 < View style = { styles . row } >
49- < TextComponent > Indeterminate</ TextComponent >
38+ < Text > Indeterminate</ Text >
5039 < View pointerEvents = "none" >
5140 < Checkbox status = { indeterminate ? 'indeterminate' : 'unchecked' } />
5241 </ View >
5342 </ View >
5443 </ TouchableRipple >
5544
5645 < View style = { styles . row } >
57- < TextComponent > Checked (Disabled)</ TextComponent >
46+ < Text > Checked (Disabled)</ Text >
5847 < Checkbox status = "checked" disabled />
5948 </ View >
6049 < View style = { styles . row } >
61- < TextComponent > Unchecked (Disabled)</ TextComponent >
50+ < Text > Unchecked (Disabled)</ Text >
6251 < Checkbox status = "unchecked" disabled />
6352 </ View >
6453 < View style = { styles . row } >
65- < TextComponent > Indeterminate (Disabled)</ TextComponent >
54+ < Text > Indeterminate (Disabled)</ Text >
6655 < Checkbox status = "indeterminate" disabled />
6756 </ View >
6857 </ ScreenWrapper >
0 commit comments