Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native - Get all results from database with SQLite and pass it to flatlist #22767

Closed
reactnativesucks opened this issue Dec 23, 2018 · 1 comment
Labels
Component: FlatList Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Type: Question Issues that are actually questions and not bug reports.

Comments

@reactnativesucks
Copy link

I am using this library: https://github.com/andpor/react-native-sqlite-storage in my project.

I retrieve single row from database like this:

constructor(props){

super(props)

this.state={
    data: []
};
db.transaction((tx) => {
  tx.executeSql('SELECT * FROM table_worker', [], (tx, results) => {
      console.log("Query completed");

    var len = results.rows.length;
    for (let i = 0; i < len; i++) {
      let row = results.rows.item(i);
      this.setState({worker_fname: row.worker_fname});
      this.setState({worker_sname: row.worker_sname});
      this.setState({worker_lname: row.worker_lname});
    }
  });
});

};

render() {
return (
  <View>
    <View>
      <Text>{this.state.worker_fname}</Text>
      <Text>{this.state.worker_sname}</Text>
      <Text>{this.state.worker_lname}</Text>
    </View>
  </View>
);
}

But now i want to fetch all data from database, and pass it to flatlist.

@reactnativesucks reactnativesucks added the Type: Question Issues that are actually questions and not bug reports. label Dec 23, 2018
@react-native-bot
Copy link
Collaborator

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.

If you'd like to propose a change or discuss a feature request, there is a repository dedicated to Discussions and Proposals you may use for this purpose.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. 📋No Template labels Dec 23, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Dec 23, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Dec 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: FlatList Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Type: Question Issues that are actually questions and not bug reports.
Projects
None yet
Development

No branches or pull requests

2 participants