File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 22import * as React from 'react'
33import { Switch } from 'react-native'
44import { Cell } from 'react-native-tableview-simple'
5+ import * as c from '../colors'
56
67type PropsType = {
78 label : string ,
@@ -10,10 +11,13 @@ type PropsType = {
1011}
1112
1213export function CellToggle ( { value, onChange, label} : PropsType ) {
13- return (
14- < Cell
15- cellAccessoryView = { < Switch onValueChange = { onChange } value = { value } /> }
16- title = { label }
14+ let toggle = (
15+ < Switch
16+ onTintColor = { c . switchTintOn }
17+ onValueChange = { onChange }
18+ value = { value }
19+ tintColor = { c . switchTintOff }
1720 />
1821 )
22+ return < Cell cellAccessoryView = { toggle } title = { label } />
1923}
Original file line number Diff line number Diff line change @@ -270,6 +270,22 @@ export const iosPushButtonCellForeground = firstReadable(
270270 [ accent , sto . black , sto . white ] ,
271271)
272272
273+ // Background color when the switch is turned on.
274+ export const switchTintOn = Platform . select ( {
275+ ios : accent ,
276+ // don't set on Android so the platform can pick the right shades from the theming system
277+ android : undefined ,
278+ } )
279+ // Border color on iOS and background color on Android when the switch is turned off.
280+ export const switchTintOff = undefined
281+ // Color of the foreground switch grip. If this is set on iOS, the switch grip will lose its drop shadow.
282+ export const switchThumbTint = Platform . select ( {
283+ // don't set on ios so we keep the drop shadow
284+ ios : undefined ,
285+ // don't set on Android so the platform can pick the right shades from the theming system
286+ android : undefined ,
287+ } )
288+
273289export const androidListHeaderBackground = sto . white
274290export const androidListHeaderForeground = firstReadable (
275291 androidListHeaderBackground ,
You can’t perform that action at this time.
0 commit comments