Skip to content

Instantly share code, notes, and snippets.

View infinitbility's full-sized avatar
🎯
Building Something Great

Inifnitbility infinitbility

🎯
Building Something Great
View GitHub Profile
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.ScrollView = React.createRef();
}
}
<ScrollView
showsVerticalScrollIndicator={false}
// define ref
ref={ref => (this.ScrollView = ref)}
// use for store scrolled value
onScroll={event =>
this.setState({horizontalScroll:event.nativeEvent.contentOffset.x, VerticalScroll:event.nativeEvent.contentOffset.y})
}
>
// Your list data
// auto scroll function
autosScroll(){
// X use for horizontal
let horizontalScroll = this.state.horizontalScroll;
// Y use for Vertical
let VerticalScroll = this.state.VerticalScroll;
this.ScrollView.scrollTo({x: horizontalScroll, y: VerticalScroll, animated: true});
import React from 'react';
import SQLite from 'react-native-sqlite-storage';
export default class SQLiteScreen extends React.Component {
constructor() {
super();
SQLite.DEBUG = true;
}
/**
import React from 'react';
import SQLite from 'react-native-sqlite-storage';
export default class SQLiteScreen extends React.Component {
constructor() {
super();
SQLite.DEBUG = true;
}
/**
import React from 'react';
import SQLite from 'react-native-sqlite-storage';
export default class SQLiteScreen extends React.Component {
constructor() {
super();
SQLite.DEBUG = true;
}
/**
import React from 'react';
import SQLite from 'react-native-sqlite-storage';
export default class SQLiteScreen extends React.Component {
constructor() {
super();
SQLite.DEBUG = true;
}
/**
import React from 'react';
import SQLite from 'react-native-sqlite-storage';
export default class SQLiteScreen extends React.Component {
constructor() {
super();
SQLite.DEBUG = true;
}
/**
@infinitbility
infinitbility / create-table.js
Last active March 29, 2020 20:05
Create Table on React Native SQLite Storage
import React from 'react';
import SQLite from 'react-native-sqlite-storage';
export default class SQLiteScreen extends React.Component {
constructor() {
super();
SQLite.DEBUG = true;
}
/**
@infinitbility
infinitbility / app.js
Created March 29, 2020 19:12
React Native SQLite Storage
// Add this code on your app.js
import SQLite from 'react-native-sqlite-storage';
global.db = SQLite.openDatabase(
{
name: 'SQLite',
location: 'default',
createFromLocation: '~SQLite.db',
},