Giter Site home page Giter Site logo

jedi-jun / rn_movie Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 2.04 MB

ReactNative tutorial with TS

JavaScript 2.55% Ruby 2.00% TypeScript 42.76% Starlark 3.00% Java 24.88% Makefile 2.37% C++ 10.95% Shell 0.76% Objective-C 3.75% Objective-C++ 6.99%
babel-plugin-root-import eslint react-native-splash-screen react-navigation-stack reactnative styled-components typescript

rn_movie's Introduction

React Native - Movie App

Reference Links

React-Navigation

  • @react-navigation/native
  • react-native-screens
  • react-native-safe-area-context
  • @react-navigation/stack
  • react-native-reanimated
  • react-native-gesture-handler
  • @react-native-community/masked-view

  • react-native-splash-screen
  • File extension: png
  • Resolution: 3000 x 3000
// 1. Module installation
$ yarn add react-native-splash-screen

// 2. Plugin installation (<== error!)
$ react-native link react-native-splash-screen

// 3. Manual method (detour)
// ..\android\settings.gradle
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')

// ..\android\app\build.gradle
dependencies {
  ...
  implementation project(':react-native-splash-screen')
}

// I skipped the below in MainApplication.java (<== skip!)
import org.devio.rn.splashscreen.SplashScreenReactPackage;
new SplashScreenReactPackage()

// 4. Plugin Configuration
import android.os.Bundle; // here
import com.facebook.react.ReactActivity;
import org.devio.rn.splashscreen.SplashScreen; // here

public class MainActivity extends ReactActivity {
   @Override
    protected void onCreate(Bundle savedInstanceState) {
        SplashScreen.show(this);  // here
        super.onCreate(savedInstanceState);
    }
    // ...other code
}

// 5. Create a launch_screen.xml
// ..\android\app\src\main\res\layout\launch_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ImageView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:src="@drawable/launch_screen" // <== error!
      android:scaleType="centerCrop" />
</RelativeLayout>

// 6. Create a launch_screen.png
drawable-ldpi
drawable-mdpi (750 x 750)
drawable-hdpi (1125 x 1125)
drawable-xhdpi (1500 x 1500)
drawable-xxhdpi (2250 x 2250)
drawable-xxxhdpi (3000 x 3000)

// 7. Add a color called 'primary_dark'
// ..\android\app\src\main\res\values\colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="primary_dark">#000000</color>
</resources>

// 8. Debugging
// ..\android\app\src\main\res\layout\launch_screen.xml
<ImageView
   android:layout_width="match_parent"
   android:layout_height="match_parent"
(-)android:src="@drawable/launch_screen" // <== error!
(+)android:src="@drawable/splashscreen"
   android:scaleType="centerCrop" />

// 9. Create a splashscreen.xml
// ..\android\app\src\main\res\drawable\splashscreen.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:drawable="@color/primary_dark" /> // <== check!
  <item>
    <bitmap
      android:gravity="center"
      android:src="@drawable/app_splash" />
  </item>
</layer-list>
// Remove splash screen

import { SplashScreen } from 'react-native-splash-screen';

useEffect(() => {
  SplashScreen.hide();
}, []);

Debugging

  1. @bam.tech/react-native.make
  • version 3.0.3
  • There are set-icon / set-splash commands
  • Did not use due to occur error
  • Try to implement a command the below for 'link'
$ yarn link @bam.tech/react-native-make // haven't tried yet.
$ react-native set-splash --path ./assets/images/app_splash.png --resize center --background "#ffffff"

// resize:
// 1. contain: 이미지 전체가 나오는 비율 (한쪽 비율에 맞추기에 하얀 영역이 나올 수 있음)
// 2. cover: 이미지가 화면에 꽉 차도록 확대 (비율에 안 맞으면 이미지의 일부가 잘림)
// 3. center: 중앙에 이미지 위치

// background: 이미지가 채워지지 않은 하얀 영역의 배경색 지정
  1. Preview window before Activity
  • Problem: white background just before starting splash screen
<!-- ..\android\app\src\main\res\values\styles.xml -->

<item name="android:windowDisablePreview">true</item>
<item name="android:windowBackground">@null</item>
<item name="android:windowIsTranslucent">true</item>​

<!-- e.g. <item name="android:windowBackground">@android:color/black</item> -->

rn_movie's People

Contributors

jedi-jun avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.