expo react native element checkbox












0














I have some checkbox based value true/false is from sqlite database. with code below sqlite updated with i expected, i only have problem in state for checked={this.state.KUSENINS1}, checked={this.state.KUSENINS2} i got error, Failed prop type: Invalid prop checked of type string supplied to CheckBox, expected boolean. and checkbock alaways on checked/true even in my database value is false the checkbox keep on checked.Any help or link for the same problem.thxu



import Expo, { SQLite } from 'expo';
import React from 'react';
import { StyleSheet, Text, View, ScrollView, ActivityIndicator, SafeAreaView, AppRegistry } from 'react-native';
import { CheckBox } from 'react-native-elements';
import database from './database';

export default class AreaSpecify extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoading: true,
numberOfRefresh: 0,
//checked: null,
data: null,
NO: null,
NOKAMAR: null,
NP: null,
LT: null,
KUSENINS1: false,
KUSENINS2: false,
KUSENINS3: false,
KUSENINS4: false,
KUSENFIN1: false,
KUSENFIN2: false,
KUSENFIN3: false,
KUSENFIN4: false,
KUSENFIN5: false,
};
}

componentDidMount(){
const { navigation } = this.props;
var NO = navigation.getParam('NO');

//var datas = projectData;
database.transaction(
tx => {
tx.executeSql('select * from List where NO = ?', [NO], (_, { rows: { _array } }) =>
{
//var data = rows._array;

this.setState({
isLoading: false,
data: _array,
NO: _array[0].NO,
NOKAMAR: _array[0].NOKAMAR,
NP: _array[0].NP,
LT: _array[0].LT,
KUSENINS1: _array[0].KUSENINS1,
KUSENINS2: _array[0].KUSENINS2,
KUSENINS3: _array[0].KUSENINS3,
KUSENINS4: _array[0].KUSENINS4,
KUSENFIN1: _array[0].KUSENFIN1,
KUSENFIN2: _array[0].KUSENFIN2,
KUSENFIN3: _array[0].KUSENFIN3,
KUSENFIN4: _array[0].KUSENFIN4,
KUSENFIN5: _array[0].KUSENFIN5,
});
console.log(this.state.data);
console.log(this.state.KUSENINS2);


}
);
},
null
);

}



render() {

if (this.state.isLoading){

return (
<SafeAreaView style={{flex: 1, flexDirection:'column'}}>
<View style={{flex: 1, flexDirection:'column'}}>
<ActivityIndicator size="small" color="#f7c744"/>
</View>
</SafeAreaView>
)

}else{

console.log(this.state.numberOfRefresh);

return (
<View style={{ flexDirection: 'column', flex: 1}}>
<View style={styles.title}>
<Text style={styles.textTittle}>Project:{this.state.NP}</Text>
<Text style={styles.textTittle}>Area:{this.state.LT} | No.Kamar/Rumah:{this.state.NOKAMAR}</Text>
</View>
<ScrollView style={{ flex: 1, flexDirection: 'column'}}>
<View style={{height:30, padding: 7}}>
<Text style={styles.textTittle}>Instalasi Kusen</Text>
</View>
<View style={styles.row}>
<Text style={styles.text}>Selesai</Text>
<Text style={styles.text}>Control Job</Text>
</View>
<View style={styles.row}>
<CheckBox checked={this.state.KUSENINS1}
title='Konsistensi Leveling Kusen'
containerStyle={{backgroundColor: 'rgba(255,255,255,0.0)'}}
onPress={() => {

var NO = this.state.NO;
var check = !this.state.KUSENINS1;
database.transaction(
tx => {
tx.executeSql("update List set KUSENINS1 = '"+ check +"' where NO = '"+ NO +"';");
this.setState({KUSENINS1:!this.state.KUSENINS1})
console.log(NO, !this.state.KUSENINS1);
},
null
);

}}/>
</View>
<View style={styles.row}>
<CheckBox checked={this.state.KUSENINS2}
title='Lot sudah tegak lurus'
containerStyle={{backgroundColor: 'rgba(255,255,255,0.0)'}}
onPress={() => {

var NO = this.state.NO;
var check = !this.state.KUSENINS2;
database.transaction(
tx => {
tx.executeSql("update List set KUSENINS2 = '"+ check +"' where NO = '"+ NO +"';");
this.setState({KUSENINS2:!this.state.KUSENINS2})
console.log(NO, !this.state.KUSENINS2);
},
null
);

}}/>
</View>
</ScrollView>
</View>
);
}

}
}


And this data fetch from sqlite for a row



Array [
Object {
"ARCDATE": "",
"ARCHFIN1": "true",
"ARCHFIN2": "true",
"ARCHFIN3": "true",
"ARCHFIN4": "true",
"ARCHFIN5": "true",
"ARCHINS1": "true",
"ARCHINS2": "true",
"ARCHITRAVE": "true",
"DEFPINTULEBAR": 90,
"DEFPINTUPANJANG": 200,
"DOORSTOP": "false",
"DSDATE": "",
"ENDDATE": "2018-12-18T17:00:00.000Z",
"GLOBALSTATUS": 0,
"HANDATE": "",
"HANDLE": "true",
"KET": "",
"KETARCHI": "",
"KETDOORSTOP": "",
"KETHANDLE": "",
"KETKUSEN": "",
"KETPINTU": "",
"KUSDATE": "",
"KUSEN": "true",
"KUSENFIN1": "false",
"KUSENFIN2": "true",
"KUSENFIN3": "true",
"KUSENFIN4": "true",
"KUSENFIN5": "true",
"KUSENGMBR": "",
"KUSENINS1": "true",
"KUSENINS2": "false",
"KUSENINS3": "false",
"KUSENINS4": "true",
"LASTUPDATE": "2018-10-31T17:00:00.000Z",
"LT": "1",
"NO": 53,
"NOKAMAR": 107,
"NP": "Novotel",
"PINTU": "true",
"PINTUDATE": "",
"PINTUFIN1": "true",
"PINTUFIN2": "true",
"PINTUFIN3": "true",
"PINTUFIN4": "true",
"PINTUFIN5": "true",
"PINTUGMBR": "",
"PINTUINS1": "true",
"PINTUINS2": "true",
"PINTUINS3": "true",
"PINTUINS4": "true",
"PINTUINS5": "true",
"REV": "",
"SEALENT": "true",
"SEALENTRAPIH": "true",
"STARTDATE": "2018-10-31T17:00:00.000Z",
"STATUS": 0,
"SUBKON": "SUBKON A",
"UKURANPINTUST": 0,
"UPINTULEBAR": 90,
"UPINTULEBAR2": 90,
"UPINTULEBAR3": 90,
"UPINTUPANJANG": 200,
},
]









share|improve this question





























    0














    I have some checkbox based value true/false is from sqlite database. with code below sqlite updated with i expected, i only have problem in state for checked={this.state.KUSENINS1}, checked={this.state.KUSENINS2} i got error, Failed prop type: Invalid prop checked of type string supplied to CheckBox, expected boolean. and checkbock alaways on checked/true even in my database value is false the checkbox keep on checked.Any help or link for the same problem.thxu



    import Expo, { SQLite } from 'expo';
    import React from 'react';
    import { StyleSheet, Text, View, ScrollView, ActivityIndicator, SafeAreaView, AppRegistry } from 'react-native';
    import { CheckBox } from 'react-native-elements';
    import database from './database';

    export default class AreaSpecify extends React.Component {
    constructor(props) {
    super(props);
    this.state = {
    isLoading: true,
    numberOfRefresh: 0,
    //checked: null,
    data: null,
    NO: null,
    NOKAMAR: null,
    NP: null,
    LT: null,
    KUSENINS1: false,
    KUSENINS2: false,
    KUSENINS3: false,
    KUSENINS4: false,
    KUSENFIN1: false,
    KUSENFIN2: false,
    KUSENFIN3: false,
    KUSENFIN4: false,
    KUSENFIN5: false,
    };
    }

    componentDidMount(){
    const { navigation } = this.props;
    var NO = navigation.getParam('NO');

    //var datas = projectData;
    database.transaction(
    tx => {
    tx.executeSql('select * from List where NO = ?', [NO], (_, { rows: { _array } }) =>
    {
    //var data = rows._array;

    this.setState({
    isLoading: false,
    data: _array,
    NO: _array[0].NO,
    NOKAMAR: _array[0].NOKAMAR,
    NP: _array[0].NP,
    LT: _array[0].LT,
    KUSENINS1: _array[0].KUSENINS1,
    KUSENINS2: _array[0].KUSENINS2,
    KUSENINS3: _array[0].KUSENINS3,
    KUSENINS4: _array[0].KUSENINS4,
    KUSENFIN1: _array[0].KUSENFIN1,
    KUSENFIN2: _array[0].KUSENFIN2,
    KUSENFIN3: _array[0].KUSENFIN3,
    KUSENFIN4: _array[0].KUSENFIN4,
    KUSENFIN5: _array[0].KUSENFIN5,
    });
    console.log(this.state.data);
    console.log(this.state.KUSENINS2);


    }
    );
    },
    null
    );

    }



    render() {

    if (this.state.isLoading){

    return (
    <SafeAreaView style={{flex: 1, flexDirection:'column'}}>
    <View style={{flex: 1, flexDirection:'column'}}>
    <ActivityIndicator size="small" color="#f7c744"/>
    </View>
    </SafeAreaView>
    )

    }else{

    console.log(this.state.numberOfRefresh);

    return (
    <View style={{ flexDirection: 'column', flex: 1}}>
    <View style={styles.title}>
    <Text style={styles.textTittle}>Project:{this.state.NP}</Text>
    <Text style={styles.textTittle}>Area:{this.state.LT} | No.Kamar/Rumah:{this.state.NOKAMAR}</Text>
    </View>
    <ScrollView style={{ flex: 1, flexDirection: 'column'}}>
    <View style={{height:30, padding: 7}}>
    <Text style={styles.textTittle}>Instalasi Kusen</Text>
    </View>
    <View style={styles.row}>
    <Text style={styles.text}>Selesai</Text>
    <Text style={styles.text}>Control Job</Text>
    </View>
    <View style={styles.row}>
    <CheckBox checked={this.state.KUSENINS1}
    title='Konsistensi Leveling Kusen'
    containerStyle={{backgroundColor: 'rgba(255,255,255,0.0)'}}
    onPress={() => {

    var NO = this.state.NO;
    var check = !this.state.KUSENINS1;
    database.transaction(
    tx => {
    tx.executeSql("update List set KUSENINS1 = '"+ check +"' where NO = '"+ NO +"';");
    this.setState({KUSENINS1:!this.state.KUSENINS1})
    console.log(NO, !this.state.KUSENINS1);
    },
    null
    );

    }}/>
    </View>
    <View style={styles.row}>
    <CheckBox checked={this.state.KUSENINS2}
    title='Lot sudah tegak lurus'
    containerStyle={{backgroundColor: 'rgba(255,255,255,0.0)'}}
    onPress={() => {

    var NO = this.state.NO;
    var check = !this.state.KUSENINS2;
    database.transaction(
    tx => {
    tx.executeSql("update List set KUSENINS2 = '"+ check +"' where NO = '"+ NO +"';");
    this.setState({KUSENINS2:!this.state.KUSENINS2})
    console.log(NO, !this.state.KUSENINS2);
    },
    null
    );

    }}/>
    </View>
    </ScrollView>
    </View>
    );
    }

    }
    }


    And this data fetch from sqlite for a row



    Array [
    Object {
    "ARCDATE": "",
    "ARCHFIN1": "true",
    "ARCHFIN2": "true",
    "ARCHFIN3": "true",
    "ARCHFIN4": "true",
    "ARCHFIN5": "true",
    "ARCHINS1": "true",
    "ARCHINS2": "true",
    "ARCHITRAVE": "true",
    "DEFPINTULEBAR": 90,
    "DEFPINTUPANJANG": 200,
    "DOORSTOP": "false",
    "DSDATE": "",
    "ENDDATE": "2018-12-18T17:00:00.000Z",
    "GLOBALSTATUS": 0,
    "HANDATE": "",
    "HANDLE": "true",
    "KET": "",
    "KETARCHI": "",
    "KETDOORSTOP": "",
    "KETHANDLE": "",
    "KETKUSEN": "",
    "KETPINTU": "",
    "KUSDATE": "",
    "KUSEN": "true",
    "KUSENFIN1": "false",
    "KUSENFIN2": "true",
    "KUSENFIN3": "true",
    "KUSENFIN4": "true",
    "KUSENFIN5": "true",
    "KUSENGMBR": "",
    "KUSENINS1": "true",
    "KUSENINS2": "false",
    "KUSENINS3": "false",
    "KUSENINS4": "true",
    "LASTUPDATE": "2018-10-31T17:00:00.000Z",
    "LT": "1",
    "NO": 53,
    "NOKAMAR": 107,
    "NP": "Novotel",
    "PINTU": "true",
    "PINTUDATE": "",
    "PINTUFIN1": "true",
    "PINTUFIN2": "true",
    "PINTUFIN3": "true",
    "PINTUFIN4": "true",
    "PINTUFIN5": "true",
    "PINTUGMBR": "",
    "PINTUINS1": "true",
    "PINTUINS2": "true",
    "PINTUINS3": "true",
    "PINTUINS4": "true",
    "PINTUINS5": "true",
    "REV": "",
    "SEALENT": "true",
    "SEALENTRAPIH": "true",
    "STARTDATE": "2018-10-31T17:00:00.000Z",
    "STATUS": 0,
    "SUBKON": "SUBKON A",
    "UKURANPINTUST": 0,
    "UPINTULEBAR": 90,
    "UPINTULEBAR2": 90,
    "UPINTULEBAR3": 90,
    "UPINTUPANJANG": 200,
    },
    ]









    share|improve this question



























      0












      0








      0







      I have some checkbox based value true/false is from sqlite database. with code below sqlite updated with i expected, i only have problem in state for checked={this.state.KUSENINS1}, checked={this.state.KUSENINS2} i got error, Failed prop type: Invalid prop checked of type string supplied to CheckBox, expected boolean. and checkbock alaways on checked/true even in my database value is false the checkbox keep on checked.Any help or link for the same problem.thxu



      import Expo, { SQLite } from 'expo';
      import React from 'react';
      import { StyleSheet, Text, View, ScrollView, ActivityIndicator, SafeAreaView, AppRegistry } from 'react-native';
      import { CheckBox } from 'react-native-elements';
      import database from './database';

      export default class AreaSpecify extends React.Component {
      constructor(props) {
      super(props);
      this.state = {
      isLoading: true,
      numberOfRefresh: 0,
      //checked: null,
      data: null,
      NO: null,
      NOKAMAR: null,
      NP: null,
      LT: null,
      KUSENINS1: false,
      KUSENINS2: false,
      KUSENINS3: false,
      KUSENINS4: false,
      KUSENFIN1: false,
      KUSENFIN2: false,
      KUSENFIN3: false,
      KUSENFIN4: false,
      KUSENFIN5: false,
      };
      }

      componentDidMount(){
      const { navigation } = this.props;
      var NO = navigation.getParam('NO');

      //var datas = projectData;
      database.transaction(
      tx => {
      tx.executeSql('select * from List where NO = ?', [NO], (_, { rows: { _array } }) =>
      {
      //var data = rows._array;

      this.setState({
      isLoading: false,
      data: _array,
      NO: _array[0].NO,
      NOKAMAR: _array[0].NOKAMAR,
      NP: _array[0].NP,
      LT: _array[0].LT,
      KUSENINS1: _array[0].KUSENINS1,
      KUSENINS2: _array[0].KUSENINS2,
      KUSENINS3: _array[0].KUSENINS3,
      KUSENINS4: _array[0].KUSENINS4,
      KUSENFIN1: _array[0].KUSENFIN1,
      KUSENFIN2: _array[0].KUSENFIN2,
      KUSENFIN3: _array[0].KUSENFIN3,
      KUSENFIN4: _array[0].KUSENFIN4,
      KUSENFIN5: _array[0].KUSENFIN5,
      });
      console.log(this.state.data);
      console.log(this.state.KUSENINS2);


      }
      );
      },
      null
      );

      }



      render() {

      if (this.state.isLoading){

      return (
      <SafeAreaView style={{flex: 1, flexDirection:'column'}}>
      <View style={{flex: 1, flexDirection:'column'}}>
      <ActivityIndicator size="small" color="#f7c744"/>
      </View>
      </SafeAreaView>
      )

      }else{

      console.log(this.state.numberOfRefresh);

      return (
      <View style={{ flexDirection: 'column', flex: 1}}>
      <View style={styles.title}>
      <Text style={styles.textTittle}>Project:{this.state.NP}</Text>
      <Text style={styles.textTittle}>Area:{this.state.LT} | No.Kamar/Rumah:{this.state.NOKAMAR}</Text>
      </View>
      <ScrollView style={{ flex: 1, flexDirection: 'column'}}>
      <View style={{height:30, padding: 7}}>
      <Text style={styles.textTittle}>Instalasi Kusen</Text>
      </View>
      <View style={styles.row}>
      <Text style={styles.text}>Selesai</Text>
      <Text style={styles.text}>Control Job</Text>
      </View>
      <View style={styles.row}>
      <CheckBox checked={this.state.KUSENINS1}
      title='Konsistensi Leveling Kusen'
      containerStyle={{backgroundColor: 'rgba(255,255,255,0.0)'}}
      onPress={() => {

      var NO = this.state.NO;
      var check = !this.state.KUSENINS1;
      database.transaction(
      tx => {
      tx.executeSql("update List set KUSENINS1 = '"+ check +"' where NO = '"+ NO +"';");
      this.setState({KUSENINS1:!this.state.KUSENINS1})
      console.log(NO, !this.state.KUSENINS1);
      },
      null
      );

      }}/>
      </View>
      <View style={styles.row}>
      <CheckBox checked={this.state.KUSENINS2}
      title='Lot sudah tegak lurus'
      containerStyle={{backgroundColor: 'rgba(255,255,255,0.0)'}}
      onPress={() => {

      var NO = this.state.NO;
      var check = !this.state.KUSENINS2;
      database.transaction(
      tx => {
      tx.executeSql("update List set KUSENINS2 = '"+ check +"' where NO = '"+ NO +"';");
      this.setState({KUSENINS2:!this.state.KUSENINS2})
      console.log(NO, !this.state.KUSENINS2);
      },
      null
      );

      }}/>
      </View>
      </ScrollView>
      </View>
      );
      }

      }
      }


      And this data fetch from sqlite for a row



      Array [
      Object {
      "ARCDATE": "",
      "ARCHFIN1": "true",
      "ARCHFIN2": "true",
      "ARCHFIN3": "true",
      "ARCHFIN4": "true",
      "ARCHFIN5": "true",
      "ARCHINS1": "true",
      "ARCHINS2": "true",
      "ARCHITRAVE": "true",
      "DEFPINTULEBAR": 90,
      "DEFPINTUPANJANG": 200,
      "DOORSTOP": "false",
      "DSDATE": "",
      "ENDDATE": "2018-12-18T17:00:00.000Z",
      "GLOBALSTATUS": 0,
      "HANDATE": "",
      "HANDLE": "true",
      "KET": "",
      "KETARCHI": "",
      "KETDOORSTOP": "",
      "KETHANDLE": "",
      "KETKUSEN": "",
      "KETPINTU": "",
      "KUSDATE": "",
      "KUSEN": "true",
      "KUSENFIN1": "false",
      "KUSENFIN2": "true",
      "KUSENFIN3": "true",
      "KUSENFIN4": "true",
      "KUSENFIN5": "true",
      "KUSENGMBR": "",
      "KUSENINS1": "true",
      "KUSENINS2": "false",
      "KUSENINS3": "false",
      "KUSENINS4": "true",
      "LASTUPDATE": "2018-10-31T17:00:00.000Z",
      "LT": "1",
      "NO": 53,
      "NOKAMAR": 107,
      "NP": "Novotel",
      "PINTU": "true",
      "PINTUDATE": "",
      "PINTUFIN1": "true",
      "PINTUFIN2": "true",
      "PINTUFIN3": "true",
      "PINTUFIN4": "true",
      "PINTUFIN5": "true",
      "PINTUGMBR": "",
      "PINTUINS1": "true",
      "PINTUINS2": "true",
      "PINTUINS3": "true",
      "PINTUINS4": "true",
      "PINTUINS5": "true",
      "REV": "",
      "SEALENT": "true",
      "SEALENTRAPIH": "true",
      "STARTDATE": "2018-10-31T17:00:00.000Z",
      "STATUS": 0,
      "SUBKON": "SUBKON A",
      "UKURANPINTUST": 0,
      "UPINTULEBAR": 90,
      "UPINTULEBAR2": 90,
      "UPINTULEBAR3": 90,
      "UPINTUPANJANG": 200,
      },
      ]









      share|improve this question















      I have some checkbox based value true/false is from sqlite database. with code below sqlite updated with i expected, i only have problem in state for checked={this.state.KUSENINS1}, checked={this.state.KUSENINS2} i got error, Failed prop type: Invalid prop checked of type string supplied to CheckBox, expected boolean. and checkbock alaways on checked/true even in my database value is false the checkbox keep on checked.Any help or link for the same problem.thxu



      import Expo, { SQLite } from 'expo';
      import React from 'react';
      import { StyleSheet, Text, View, ScrollView, ActivityIndicator, SafeAreaView, AppRegistry } from 'react-native';
      import { CheckBox } from 'react-native-elements';
      import database from './database';

      export default class AreaSpecify extends React.Component {
      constructor(props) {
      super(props);
      this.state = {
      isLoading: true,
      numberOfRefresh: 0,
      //checked: null,
      data: null,
      NO: null,
      NOKAMAR: null,
      NP: null,
      LT: null,
      KUSENINS1: false,
      KUSENINS2: false,
      KUSENINS3: false,
      KUSENINS4: false,
      KUSENFIN1: false,
      KUSENFIN2: false,
      KUSENFIN3: false,
      KUSENFIN4: false,
      KUSENFIN5: false,
      };
      }

      componentDidMount(){
      const { navigation } = this.props;
      var NO = navigation.getParam('NO');

      //var datas = projectData;
      database.transaction(
      tx => {
      tx.executeSql('select * from List where NO = ?', [NO], (_, { rows: { _array } }) =>
      {
      //var data = rows._array;

      this.setState({
      isLoading: false,
      data: _array,
      NO: _array[0].NO,
      NOKAMAR: _array[0].NOKAMAR,
      NP: _array[0].NP,
      LT: _array[0].LT,
      KUSENINS1: _array[0].KUSENINS1,
      KUSENINS2: _array[0].KUSENINS2,
      KUSENINS3: _array[0].KUSENINS3,
      KUSENINS4: _array[0].KUSENINS4,
      KUSENFIN1: _array[0].KUSENFIN1,
      KUSENFIN2: _array[0].KUSENFIN2,
      KUSENFIN3: _array[0].KUSENFIN3,
      KUSENFIN4: _array[0].KUSENFIN4,
      KUSENFIN5: _array[0].KUSENFIN5,
      });
      console.log(this.state.data);
      console.log(this.state.KUSENINS2);


      }
      );
      },
      null
      );

      }



      render() {

      if (this.state.isLoading){

      return (
      <SafeAreaView style={{flex: 1, flexDirection:'column'}}>
      <View style={{flex: 1, flexDirection:'column'}}>
      <ActivityIndicator size="small" color="#f7c744"/>
      </View>
      </SafeAreaView>
      )

      }else{

      console.log(this.state.numberOfRefresh);

      return (
      <View style={{ flexDirection: 'column', flex: 1}}>
      <View style={styles.title}>
      <Text style={styles.textTittle}>Project:{this.state.NP}</Text>
      <Text style={styles.textTittle}>Area:{this.state.LT} | No.Kamar/Rumah:{this.state.NOKAMAR}</Text>
      </View>
      <ScrollView style={{ flex: 1, flexDirection: 'column'}}>
      <View style={{height:30, padding: 7}}>
      <Text style={styles.textTittle}>Instalasi Kusen</Text>
      </View>
      <View style={styles.row}>
      <Text style={styles.text}>Selesai</Text>
      <Text style={styles.text}>Control Job</Text>
      </View>
      <View style={styles.row}>
      <CheckBox checked={this.state.KUSENINS1}
      title='Konsistensi Leveling Kusen'
      containerStyle={{backgroundColor: 'rgba(255,255,255,0.0)'}}
      onPress={() => {

      var NO = this.state.NO;
      var check = !this.state.KUSENINS1;
      database.transaction(
      tx => {
      tx.executeSql("update List set KUSENINS1 = '"+ check +"' where NO = '"+ NO +"';");
      this.setState({KUSENINS1:!this.state.KUSENINS1})
      console.log(NO, !this.state.KUSENINS1);
      },
      null
      );

      }}/>
      </View>
      <View style={styles.row}>
      <CheckBox checked={this.state.KUSENINS2}
      title='Lot sudah tegak lurus'
      containerStyle={{backgroundColor: 'rgba(255,255,255,0.0)'}}
      onPress={() => {

      var NO = this.state.NO;
      var check = !this.state.KUSENINS2;
      database.transaction(
      tx => {
      tx.executeSql("update List set KUSENINS2 = '"+ check +"' where NO = '"+ NO +"';");
      this.setState({KUSENINS2:!this.state.KUSENINS2})
      console.log(NO, !this.state.KUSENINS2);
      },
      null
      );

      }}/>
      </View>
      </ScrollView>
      </View>
      );
      }

      }
      }


      And this data fetch from sqlite for a row



      Array [
      Object {
      "ARCDATE": "",
      "ARCHFIN1": "true",
      "ARCHFIN2": "true",
      "ARCHFIN3": "true",
      "ARCHFIN4": "true",
      "ARCHFIN5": "true",
      "ARCHINS1": "true",
      "ARCHINS2": "true",
      "ARCHITRAVE": "true",
      "DEFPINTULEBAR": 90,
      "DEFPINTUPANJANG": 200,
      "DOORSTOP": "false",
      "DSDATE": "",
      "ENDDATE": "2018-12-18T17:00:00.000Z",
      "GLOBALSTATUS": 0,
      "HANDATE": "",
      "HANDLE": "true",
      "KET": "",
      "KETARCHI": "",
      "KETDOORSTOP": "",
      "KETHANDLE": "",
      "KETKUSEN": "",
      "KETPINTU": "",
      "KUSDATE": "",
      "KUSEN": "true",
      "KUSENFIN1": "false",
      "KUSENFIN2": "true",
      "KUSENFIN3": "true",
      "KUSENFIN4": "true",
      "KUSENFIN5": "true",
      "KUSENGMBR": "",
      "KUSENINS1": "true",
      "KUSENINS2": "false",
      "KUSENINS3": "false",
      "KUSENINS4": "true",
      "LASTUPDATE": "2018-10-31T17:00:00.000Z",
      "LT": "1",
      "NO": 53,
      "NOKAMAR": 107,
      "NP": "Novotel",
      "PINTU": "true",
      "PINTUDATE": "",
      "PINTUFIN1": "true",
      "PINTUFIN2": "true",
      "PINTUFIN3": "true",
      "PINTUFIN4": "true",
      "PINTUFIN5": "true",
      "PINTUGMBR": "",
      "PINTUINS1": "true",
      "PINTUINS2": "true",
      "PINTUINS3": "true",
      "PINTUINS4": "true",
      "PINTUINS5": "true",
      "REV": "",
      "SEALENT": "true",
      "SEALENTRAPIH": "true",
      "STARTDATE": "2018-10-31T17:00:00.000Z",
      "STATUS": 0,
      "SUBKON": "SUBKON A",
      "UKURANPINTUST": 0,
      "UPINTULEBAR": 90,
      "UPINTULEBAR2": 90,
      "UPINTULEBAR3": 90,
      "UPINTUPANJANG": 200,
      },
      ]






      android react-native checkbox expo






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 20 '18 at 20:55

























      asked Nov 20 '18 at 20:49









      andri wda

      11




      11
























          1 Answer
          1






          active

          oldest

          votes


















          0














          i solve this by change this part of code, to make state from database value as boolean



          componentDidMount(){
          const { navigation } = this.props;
          var NO = navigation.getParam('NO');
          //var datas = projectData;
          database.transaction(
          tx => {
          tx.executeSql('select * from List where NO = ?', [NO], (_, { rows: { _array } }) =>
          {
          //var data = rows._array;

          this.setState({
          isLoading: false,
          data: _array,
          NO: _array[0].NO,
          NOKAMAR: _array[0].NOKAMAR,
          NP: _array[0].NP,
          LT: _array[0].LT,
          KUSENINS1: _array[0].KUSENINS1 == 'true' ? true : false,
          KUSENINS2: _array[0].KUSENINS2 == 'true' ? true : false,
          KUSENINS3: _array[0].KUSENINS3 == 'true' ? true : false,
          KUSENINS4: _array[0].KUSENINS4 == 'true' ? true : false,
          KUSENFIN1: _array[0].KUSENFIN1 == 'true' ? true : false,
          KUSENFIN2: _array[0].KUSENFIN2 == 'true' ? true : false,
          KUSENFIN3: _array[0].KUSENFIN3 == 'true' ? true : false,
          KUSENFIN4: _array[0].KUSENFIN4 == 'true' ? true : false,
          KUSENFIN5: _array[0].KUSENFIN5 == 'true' ? true : false,
          });
          console.log(this.state.data);
          console.log(this.state.KUSENINS1, this.state.KUSENINS2);


          }
          );
          },
          null
          );
          }





          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401287%2fexpo-react-native-element-checkbox%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            i solve this by change this part of code, to make state from database value as boolean



            componentDidMount(){
            const { navigation } = this.props;
            var NO = navigation.getParam('NO');
            //var datas = projectData;
            database.transaction(
            tx => {
            tx.executeSql('select * from List where NO = ?', [NO], (_, { rows: { _array } }) =>
            {
            //var data = rows._array;

            this.setState({
            isLoading: false,
            data: _array,
            NO: _array[0].NO,
            NOKAMAR: _array[0].NOKAMAR,
            NP: _array[0].NP,
            LT: _array[0].LT,
            KUSENINS1: _array[0].KUSENINS1 == 'true' ? true : false,
            KUSENINS2: _array[0].KUSENINS2 == 'true' ? true : false,
            KUSENINS3: _array[0].KUSENINS3 == 'true' ? true : false,
            KUSENINS4: _array[0].KUSENINS4 == 'true' ? true : false,
            KUSENFIN1: _array[0].KUSENFIN1 == 'true' ? true : false,
            KUSENFIN2: _array[0].KUSENFIN2 == 'true' ? true : false,
            KUSENFIN3: _array[0].KUSENFIN3 == 'true' ? true : false,
            KUSENFIN4: _array[0].KUSENFIN4 == 'true' ? true : false,
            KUSENFIN5: _array[0].KUSENFIN5 == 'true' ? true : false,
            });
            console.log(this.state.data);
            console.log(this.state.KUSENINS1, this.state.KUSENINS2);


            }
            );
            },
            null
            );
            }





            share|improve this answer


























              0














              i solve this by change this part of code, to make state from database value as boolean



              componentDidMount(){
              const { navigation } = this.props;
              var NO = navigation.getParam('NO');
              //var datas = projectData;
              database.transaction(
              tx => {
              tx.executeSql('select * from List where NO = ?', [NO], (_, { rows: { _array } }) =>
              {
              //var data = rows._array;

              this.setState({
              isLoading: false,
              data: _array,
              NO: _array[0].NO,
              NOKAMAR: _array[0].NOKAMAR,
              NP: _array[0].NP,
              LT: _array[0].LT,
              KUSENINS1: _array[0].KUSENINS1 == 'true' ? true : false,
              KUSENINS2: _array[0].KUSENINS2 == 'true' ? true : false,
              KUSENINS3: _array[0].KUSENINS3 == 'true' ? true : false,
              KUSENINS4: _array[0].KUSENINS4 == 'true' ? true : false,
              KUSENFIN1: _array[0].KUSENFIN1 == 'true' ? true : false,
              KUSENFIN2: _array[0].KUSENFIN2 == 'true' ? true : false,
              KUSENFIN3: _array[0].KUSENFIN3 == 'true' ? true : false,
              KUSENFIN4: _array[0].KUSENFIN4 == 'true' ? true : false,
              KUSENFIN5: _array[0].KUSENFIN5 == 'true' ? true : false,
              });
              console.log(this.state.data);
              console.log(this.state.KUSENINS1, this.state.KUSENINS2);


              }
              );
              },
              null
              );
              }





              share|improve this answer
























                0












                0








                0






                i solve this by change this part of code, to make state from database value as boolean



                componentDidMount(){
                const { navigation } = this.props;
                var NO = navigation.getParam('NO');
                //var datas = projectData;
                database.transaction(
                tx => {
                tx.executeSql('select * from List where NO = ?', [NO], (_, { rows: { _array } }) =>
                {
                //var data = rows._array;

                this.setState({
                isLoading: false,
                data: _array,
                NO: _array[0].NO,
                NOKAMAR: _array[0].NOKAMAR,
                NP: _array[0].NP,
                LT: _array[0].LT,
                KUSENINS1: _array[0].KUSENINS1 == 'true' ? true : false,
                KUSENINS2: _array[0].KUSENINS2 == 'true' ? true : false,
                KUSENINS3: _array[0].KUSENINS3 == 'true' ? true : false,
                KUSENINS4: _array[0].KUSENINS4 == 'true' ? true : false,
                KUSENFIN1: _array[0].KUSENFIN1 == 'true' ? true : false,
                KUSENFIN2: _array[0].KUSENFIN2 == 'true' ? true : false,
                KUSENFIN3: _array[0].KUSENFIN3 == 'true' ? true : false,
                KUSENFIN4: _array[0].KUSENFIN4 == 'true' ? true : false,
                KUSENFIN5: _array[0].KUSENFIN5 == 'true' ? true : false,
                });
                console.log(this.state.data);
                console.log(this.state.KUSENINS1, this.state.KUSENINS2);


                }
                );
                },
                null
                );
                }





                share|improve this answer












                i solve this by change this part of code, to make state from database value as boolean



                componentDidMount(){
                const { navigation } = this.props;
                var NO = navigation.getParam('NO');
                //var datas = projectData;
                database.transaction(
                tx => {
                tx.executeSql('select * from List where NO = ?', [NO], (_, { rows: { _array } }) =>
                {
                //var data = rows._array;

                this.setState({
                isLoading: false,
                data: _array,
                NO: _array[0].NO,
                NOKAMAR: _array[0].NOKAMAR,
                NP: _array[0].NP,
                LT: _array[0].LT,
                KUSENINS1: _array[0].KUSENINS1 == 'true' ? true : false,
                KUSENINS2: _array[0].KUSENINS2 == 'true' ? true : false,
                KUSENINS3: _array[0].KUSENINS3 == 'true' ? true : false,
                KUSENINS4: _array[0].KUSENINS4 == 'true' ? true : false,
                KUSENFIN1: _array[0].KUSENFIN1 == 'true' ? true : false,
                KUSENFIN2: _array[0].KUSENFIN2 == 'true' ? true : false,
                KUSENFIN3: _array[0].KUSENFIN3 == 'true' ? true : false,
                KUSENFIN4: _array[0].KUSENFIN4 == 'true' ? true : false,
                KUSENFIN5: _array[0].KUSENFIN5 == 'true' ? true : false,
                });
                console.log(this.state.data);
                console.log(this.state.KUSENINS1, this.state.KUSENINS2);


                }
                );
                },
                null
                );
                }






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 22 '18 at 19:39









                andri wda

                11




                11






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401287%2fexpo-react-native-element-checkbox%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin