Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Commit

Permalink
fix: minor tweaks for web and fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Oct 31, 2019
1 parent 3de9edb commit 67fd69a
Show file tree
Hide file tree
Showing 8 changed files with 269 additions and 225 deletions.
3 changes: 2 additions & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"react-native-gesture-handler": "~1.3.0",
"react-native-paper": "^3.1.1",
"react-native-reanimated": "~1.2.0",
"react-native-reanimated-web": "npm:react-native-reanimated@^1.3.2",
"react-native-safe-area-context": "~0.3.6",
"react-native-screens": "^2.0.0-alpha.6",
"react-native-tab-view": "2.10.0",
Expand All @@ -44,7 +45,7 @@
"@types/react": "^16.9.4",
"@types/react-native": "^0.60.19",
"babel-preset-expo": "^7.0.0",
"expo-cli": "^3.3.0",
"expo-cli": "^3.4.1",
"jetifier": "^1.6.4",
"typescript": "^3.6.3"
}
Expand Down
5 changes: 2 additions & 3 deletions packages/example/src/Screens/NativeStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { Button } from 'react-native-paper';
// eslint-disable-next-line import/no-unresolved
import { useScreens } from 'react-native-screens';
import { enableScreens } from 'react-native-screens';
import {
RouteProp,
ParamListBase,
Expand Down Expand Up @@ -124,8 +124,7 @@ export default function NativeStackScreen({ navigation }: Props) {
);
}

// eslint-disable-next-line react-hooks/rules-of-hooks
useScreens(true);
enableScreens(true);

const styles = StyleSheet.create({
buttons: {
Expand Down
23 changes: 23 additions & 0 deletions packages/example/src/Screens/NativeStack.web.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as React from 'react';
import { View, Text, StyleSheet } from 'react-native';

export default function NativeStack() {
return (
<View style={styles.container}>
<Text style={styles.text}>Not supported on Web :(</Text>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#eceff1',
},
text: {
fontSize: 16,
color: '#999',
},
});
37 changes: 18 additions & 19 deletions packages/example/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,31 @@ module.exports = async function(env, argv) {
config.module.rules.push({
test: /\.(js|ts|tsx)$/,
include: /packages\/.+/,
exclude: /node_modules/,
use: 'babel-loader',
});

config.resolve.plugins = config.resolve.plugins.filter(
p => !(p instanceof ModuleScopePlugin)
);

config.resolve.alias['react'] = path.resolve(
__dirname,
'node_modules',
'react'
);
config.resolve.alias['react-native'] = path.resolve(
__dirname,
'node_modules',
'react-native-web'
);
config.resolve.alias['react-native-web'] = path.resolve(
__dirname,
'node_modules',
'react-native-web'
);

config.resolve.alias[
'@expo/vector-icons/MaterialCommunityIcons'
] = require.resolve('@expo/vector-icons/MaterialCommunityIcons');
Object.assign(config.resolve.alias, {
react: path.resolve(__dirname, 'node_modules', 'react'),
'react-native': path.resolve(__dirname, 'node_modules', 'react-native-web'),
'react-native-web': path.resolve(
__dirname,
'node_modules',
'react-native-web'
),
'react-native-reanimated': path.resolve(
__dirname,
'node_modules',
'react-native-reanimated-web'
),
'@expo/vector-icons/MaterialCommunityIcons': require.resolve(
'@expo/vector-icons/MaterialCommunityIcons'
),
});

fs.readdirSync(path.join(__dirname, '..')).forEach(name => {
config.resolve.alias[`@react-navigation/${name}`] = path.resolve(
Expand Down
5 changes: 2 additions & 3 deletions packages/stack/src/views/Header/HeaderBackground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ const styles = StyleSheet.create({
},
},
default: {
// https://github.com/necolas/react-native-web/issues/44
// Material Design
boxShadow: `0 2px 4px -1px rgba(0,0,0,0.2), 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12)`,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: 'rgba(0, 0, 0, 0.20)',
},
}),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/stack/src/views/Header/HeaderTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const styles = StyleSheet.create({
},
default: {
fontSize: 18,
fontWeight: '400',
fontWeight: '500',
color: '#3c4043',
},
}),
Expand Down
Binary file modified packages/stack/src/views/assets/back-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 67fd69a

Please sign in to comment.