Skip to content

Instantly share code, notes, and snippets.

@balinux
Last active October 5, 2019 15:23
Show Gist options
  • Save balinux/51811565dda15703197a5075f4792ef0 to your computer and use it in GitHub Desktop.
Save balinux/51811565dda15703197a5075f4792ef0 to your computer and use it in GitHub Desktop.
react native tips and trick
kumpulan tips react native
@balinux
Copy link
Author

balinux commented Dec 13, 2018

memberikan parameter navigasi pada navigation Options

const AppStackNavigator = createStackNavigator({
  AppTabNavigator: {
    screen: AppTabNavigator,
    navigationOptions: ({ navigation }) => ({
      title: 'Your App',
      headerLeft: (
        <TouchableOpacity onPress={() => navigation.toggleDrawer()}>
          <View style={{ paddingHorizontal: 10 }}>
            <Icon name="md-menu" size={24} />
          </View>
        </TouchableOpacity>
      )
    })
  }
})

@balinux
Copy link
Author

balinux commented Dec 13, 2018

react navigation auth flow, lengkap dengan konsep penggabungan semua jenis navigasi

https://www.youtube.com/playlist?list=PLy9JCsy2u97nn0Yrf3ioMbRL7guVlzk9d

@balinux
Copy link
Author

balinux commented Dec 18, 2018

navigationopntions styling

static navigationOptions = {
          title: 'Home',
          headerTintColor: '#ffffff',
          headerStyle: {
            backgroundColor: '#2F95D6',
            borderBottomColor: '#ffffff',
            borderBottomWidth: 3,
          },
          headerTitleStyle: {
            fontSize: 18,
          },
      };

@balinux
Copy link
Author

balinux commented Jan 5, 2019

Could not install the app on the device, read the error above for details.

run chmod 755 android/gradlew inside your app root folder
then run react-native run-android

@balinux
Copy link
Author

balinux commented Jan 10, 2019

Access the navigation prop from any component
https://reactnavigation.org/docs/en/connecting-navigation-prop.html

@balinux
Copy link
Author

balinux commented Jan 11, 2019

https://github.com/react-native-community/react-native-image-picker

yarn add react-native-image-picker
react-native link react-native-image-picker

@balinux
Copy link
Author

balinux commented Jan 16, 2019

Updating an object with setState in React

There are multiple ways of doing this.

1- Simplest one:

First create a copy of jasper then do the changes in that:

let jasper = Object.assign({}, this.state.jasper);    //creating copy of object
jasper.name = 'someothername';                        //updating value
this.setState({jasper});
Instead of using Object.assign we can also write it like this:

let jasper = {...this.state.jasper};
2- Using spread operator:

this.setState(prevState => ({
    jasper: {
        ...prevState.jasper,
        name: 'something'
    }
}))

link : https://stackoverflow.com/questions/43638938/updating-an-object-with-setstate-in-react

@balinux
Copy link
Author

balinux commented Jan 18, 2019

export multiple function react native
https://www.youtube.com/watch?v=qPkRIgwOx1M

@balinux
Copy link
Author

balinux commented Feb 12, 2019

@balinux
Copy link
Author

balinux commented Feb 15, 2019

@balinux
Copy link
Author

balinux commented Feb 18, 2019

react native image overflow hidden
untuk meyembunyikan image dibalik container
https://github.com/react-native-training/react-native-elements/issues/884

@balinux
Copy link
Author

balinux commented Feb 28, 2019

#pengalaman menggunakan RN FIrebase

  1. repo https://github.com/rohitmodi12/firebasePushnotificaiton
  2. video tutorial rnFirebase : https://www.youtube.com/watch?v=nHvw1mcaOs0
  3. video tutorial server push notification firebase : https://www.youtube.com/watch?v=6uZ7Fw8AVlk
  4. push server : http://pushtry.com/

@balinux
Copy link
Author

balinux commented May 2, 2019

membuat shadow effet di react native

shadowColor: "#000",
shadowOffset: {
width: 0,
height: 4,
},
shadowOpacity: 0.30,
shadowRadius: 4.65,

elevation: 8,

link generator : https://ethercreative.github.io/react-native-shadow-generator/

@balinux
Copy link
Author

balinux commented May 16, 2019

@balinux
Copy link
Author

balinux commented May 22, 2019

@balinux
Copy link
Author

balinux commented May 26, 2019

dokumentasi dan link belajar React native beserta contohnya

@balinux
Copy link
Author

balinux commented Jul 15, 2019

React native Map

catatan : setelah release app aplikasi juga membutuhkan Sidik jari sertifikat SHA-1 dari playstore di bagian Sertifikat penandatanganan aplikasi

@balinux
Copy link
Author

balinux commented Sep 13, 2019

infinite scroll react hook

refeerensi
example code

@balinux
Copy link
Author

balinux commented Oct 2, 2019

run emulator form CLI

move to dir C:\Users\USDI_RIO\AppData\Local\Android\Sdk\emulator

List Emulator

emulator -list-avds

Run Emulator

emulator -avd @name of emulator

add to windows path (optional)

  • go to environment variables
  • clint environment variables
  • system variables clict path variables
  • new and paste ``C:\Users\USDI_RIO\AppData\Local\Android\Sdk\emulator`

@balinux
Copy link
Author

balinux commented Oct 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment