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

feat: update example app #827

Merged
merged 63 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
ec98b26
chore: update babel and metro resolver logic
kacperkapusciak Feb 18, 2021
a8c75b1
chore: update dependencies
kacperkapusciak Feb 18, 2021
781a156
feat: add prettier
kacperkapusciak Feb 18, 2021
b168e47
feat: add Typescript support
kacperkapusciak Feb 18, 2021
9b1fcf6
feat: add Typescript dependencies
kacperkapusciak Feb 18, 2021
2ace73f
feat: implement main screen
kacperkapusciak Feb 18, 2021
7a54980
feat: implement simple examples
kacperkapusciak Feb 22, 2021
e5f2c54
feat: add header options playground
kacperkapusciak Feb 22, 2021
da00372
feat: add more options to header playground
kacperkapusciak Feb 24, 2021
ca8cc2b
fix: make statusbar visible
kacperkapusciak Feb 24, 2021
6f8e142
fix: settings switch code cleanup
kacperkapusciak Feb 24, 2021
06aa5ff
feat: add status bar playground
kacperkapusciak Feb 24, 2021
7339b88
fix: styles fix
kacperkapusciak Feb 25, 2021
404b9d9
feat: add animations playground
kacperkapusciak Feb 25, 2021
6efc75e
feat: update bottom tabs example
kacperkapusciak Feb 26, 2021
d31a12c
chore: remove unused legacy code
kacperkapusciak Feb 26, 2021
d4e2485
feat: improve legibility on android
kacperkapusciak Feb 26, 2021
fc9c83d
fix: typo
kacperkapusciak Feb 26, 2021
1e62166
feat: add react-navigation v4 stack example
kacperkapusciak Feb 26, 2021
66ad54a
fix: run v4 example in compatibility layer
kacperkapusciak Mar 1, 2021
8909463
feat: add TS support to v4 navigation example
kacperkapusciak Mar 1, 2021
a678f0f
fix: fix NativeNavigation modal
kacperkapusciak Mar 1, 2021
fdc1f43
Merge remote-tracking branch 'origin/master' into @kacperkapusciak/up…
kacperkapusciak Mar 2, 2021
2e44f97
fix: fix Animations playground
kacperkapusciak Mar 2, 2021
f9247b3
fix: typo
kacperkapusciak Mar 2, 2021
b72b4c8
feat: differentiate between example and playground
kacperkapusciak Mar 2, 2021
f998270
chore: remove unused legacy code
kacperkapusciak Mar 2, 2021
a851c9d
chore: clean up config files
kacperkapusciak Mar 4, 2021
df9514c
feat: remove NativeNavigation example
kacperkapusciak Mar 4, 2021
802ed37
fix: enableScreens once in the app
kacperkapusciak Mar 4, 2021
d83a006
feat: make SettingsPicker generic
kacperkapusciak Mar 5, 2021
121f7e6
fix: better types, code clean-up
kacperkapusciak Mar 5, 2021
f64fbb6
feat: add second screen to StatusBar example
kacperkapusciak Mar 5, 2021
51deeac
feat: add Modals example
kacperkapusciak Mar 5, 2021
2cbead9
fix: remove unnecessary eslint-disable
kacperkapusciak Mar 5, 2021
a863258
fix: fix lining errors in StackPresentation
kacperkapusciak Mar 5, 2021
7207ed0
fix: simplify TypeScript boilerplate
kacperkapusciak Mar 5, 2021
5eab1b2
fix: wrap HeaderOptions with ScrollView
kacperkapusciak Mar 5, 2021
877fdda
feat: add colors to better see transitions 💅
kacperkapusciak Mar 9, 2021
f2a7e54
feat: hide back button on Android
kacperkapusciak Mar 9, 2021
0ebaefd
fix: add contentInsetAdjustmentBehavior
kacperkapusciak Mar 9, 2021
515ea01
feat: add modal to StatusBar example
kacperkapusciak Mar 9, 2021
9e6bd16
chore: bump TS version
kacperkapusciak Mar 9, 2021
156ea30
chore: update project to RN 0.64.0
kacperkapusciak Mar 15, 2021
f7bd96e
Revert "chore: update project to RN 0.64.0"
kacperkapusciak Mar 15, 2021
be889c4
fix: remove circular dependency
kacperkapusciak Mar 17, 2021
4ab382e
feat: make stackPresentation example interesting
kacperkapusciak Mar 17, 2021
236e31b
feat: change default values in Header playground
kacperkapusciak Mar 17, 2021
7f429e4
fix: animation when pushing new screen
kacperkapusciak Mar 17, 2021
c5fe956
feat: add Orientation playground
kacperkapusciak Mar 18, 2021
0b4612a
feat: add change rtl/ltr direction
kacperkapusciak Mar 18, 2021
7b755f0
fix: alert component
kacperkapusciak Mar 18, 2021
6b9de64
fix: typo
kacperkapusciak Mar 18, 2021
85e8e17
fix: remove unnecessary statusBarStyle prop
kacperkapusciak Mar 22, 2021
4cca989
fix: hide header for containedTransparentModal
kacperkapusciak Mar 22, 2021
8aecfb8
fix: make header proper height on android
kacperkapusciak Mar 22, 2021
4af99c2
fix: remove redundant configuration
kacperkapusciak Mar 22, 2021
3d2870e
chore: code cleanup
kacperkapusciak Mar 22, 2021
f9631c5
fix: set header translucent from JS code
kacperkapusciak Mar 22, 2021
38ccd00
feat: add backdrop to dialog
kacperkapusciak Mar 22, 2021
b509455
feat: change alert animation on android
kacperkapusciak Mar 22, 2021
1cdb73f
feat: change containedTransparentModal animation
kacperkapusciak Mar 22, 2021
5fe30e5
fix: add supportsRtl flag to AndroidManifest
kacperkapusciak Mar 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Example/.gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.pbxproj -text
# Windows files should use crlf line endings
# https://help.github.com/articles/dealing-with-line-endings/
*.bat text eol=crlf
6 changes: 6 additions & 0 deletions Example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};
113 changes: 0 additions & 113 deletions Example/App.js

This file was deleted.

143 changes: 143 additions & 0 deletions Example/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import React from 'react';
import {ScrollView, SafeAreaView, StyleSheet, Text} from 'react-native';
import {enableScreens} from 'react-native-screens';
import {NavigationContainer} from '@react-navigation/native';
import {StackNavigationProp} from '@react-navigation/stack';
import {createNativeStackNavigator} from 'react-native-screens/native-stack';

import {MenuItem} from './src/shared';

import SimpleNativeStack from './src/screens/SimpleNativeStack';
import StackPresentation from './src/screens/StackPresentation';
import HeaderOptions from './src/screens/HeaderOptions';
import StatusBar from './src/screens/StatusBar';
import Animations from './src/screens/Animations';
import BottomTabsAndStack from './src/screens/BottomTabsAndStack';
import StackReactNavigation4 from './src/screens/StackReactNavigation4';
import Modals from './src/screens/Modals';

enableScreens();

const SCREENS: Record<
string,
{
title: string;
component: () => JSX.Element;
type: 'example' | 'playground';
}
> = {
SimpleNativeStack: {
title: 'Simple Native Stack',
component: SimpleNativeStack,
type: 'example',
},
StackPresentation: {
title: 'Stack Presentation',
component: StackPresentation,
type: 'example',
},
BottomTabsAndStack: {
title: 'Bottom tabs and native stack',
component: BottomTabsAndStack,
type: 'example',
},
Modals: {
title: 'Modals',
component: Modals,
type: 'example',
},
StackReactNavigation4: {
title: 'Stack react-navigation v4',
// @ts-ignore react-navigation v4 AppNavigator type
component: StackReactNavigation4,
type: 'example',
},
HeaderOptions: {
title: 'Header Options',
component: HeaderOptions,
type: 'playground',
},
StatusBar: {
title: 'Status bar (iOS)',
component: StatusBar,
type: 'playground',
},
Animations: {
title: 'Animations',
component: Animations,
type: 'playground',
},
};

type RootStackParamList = {
Main: undefined;
} & {
[P in keyof typeof SCREENS]: undefined;
};

const Stack = createNativeStackNavigator<RootStackParamList>();

interface MainScreenProps {
navigation: StackNavigationProp<RootStackParamList, 'Main'>;
}

const MainScreen = ({navigation}: MainScreenProps): JSX.Element => (
<ScrollView>
<SafeAreaView>
<Text style={styles.label}>Examples</Text>
{Object.keys(SCREENS)
.filter((name) => SCREENS[name].type === 'example')
.map((name) => (
<MenuItem
key={name}
title={SCREENS[name].title}
onPress={() => navigation.navigate(name)}
/>
))}
<Text style={styles.label}>Playgrounds</Text>
{Object.keys(SCREENS)
.filter((name) => SCREENS[name].type === 'playground')
.map((name) => (
<MenuItem
key={name}
title={SCREENS[name].title}
onPress={() => navigation.navigate(name)}
/>
))}
</SafeAreaView>
</ScrollView>
);

const ExampleApp = (): JSX.Element => (
<NavigationContainer>
<Stack.Navigator
screenOptions={{
statusBarStyle: 'dark',
kacperkapusciak marked this conversation as resolved.
Show resolved Hide resolved
kacperkapusciak marked this conversation as resolved.
Show resolved Hide resolved
}}>
<Stack.Screen
name="Main"
options={{title: '📱 React Native Screens Examples'}}
component={MainScreen}
/>
{Object.keys(SCREENS).map((name) => (
<Stack.Screen
key={name}
name={name}
getComponent={() => SCREENS[name].component}
options={{headerShown: false}}
/>
))}
</Stack.Navigator>
</NavigationContainer>
);

const styles = StyleSheet.create({
label: {
fontSize: 15,
color: 'black',
margin: 10,
marginTop: 15,
},
});

export default ExampleApp;
2 changes: 1 addition & 1 deletion Example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
classpath('com.android.tools.build:gradle:4.1.0')
}
}

Expand Down
3 changes: 2 additions & 1 deletion Example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Thu Feb 18 09:11:40 CET 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
21 changes: 3 additions & 18 deletions Example/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -64,28 +64,13 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
7 changes: 1 addition & 6 deletions Example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
module.exports = {
presets: ['babel-preset-expo'],
plugins: [
'@babel/plugin-transform-modules-commonjs',
[
'module-resolver',
{
alias: {
'react-native-screens': '../src',
'react': './node_modules/react',
'react-native': './node_modules/react-native',
'@babel': './node_modules/@babel',
'@react-navigation/native': './node_modules/@react-navigation/native/src',
'react-native-screens': '../src'
},
},
],
Expand Down
10 changes: 7 additions & 3 deletions Example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ target 'ScreensExample' do

pod 'RNScreens', :path => '../../'

use_react_native!(:path => config["reactNativePath"])
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)

# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
# you should disable the next line.
use_flipper!()
kacperkapusciak marked this conversation as resolved.
Show resolved Hide resolved
post_install do |installer|
flipper_post_install(installer)
end
Expand Down
Loading