Skip to content

Commit bbc3d57

Browse files
committed
First pass with react native
1 parent b7219ee commit bbc3d57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+30723
-5963
lines changed

.gitignore

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,79 @@ vendor
2727

2828
.spago
2929

30-
.parcel-cache
30+
.parcel-cache
31+
32+
# OSX
33+
#
34+
.DS_Store
35+
36+
# Xcode
37+
#
38+
build/
39+
*.pbxuser
40+
!default.pbxuser
41+
*.mode1v3
42+
!default.mode1v3
43+
*.mode2v3
44+
!default.mode2v3
45+
*.perspectivev3
46+
!default.perspectivev3
47+
xcuserdata
48+
*.xccheckout
49+
*.moved-aside
50+
DerivedData
51+
*.hmap
52+
*.ipa
53+
*.xcuserstate
54+
**/.xcode.env.local
55+
56+
# Android/IntelliJ
57+
#
58+
build/
59+
.idea
60+
.gradle
61+
local.properties
62+
*.iml
63+
*.hprof
64+
.cxx/
65+
*.keystore
66+
!debug.keystore
67+
68+
# node.js
69+
#
70+
node_modules/
71+
npm-debug.log
72+
yarn-error.log
73+
74+
# fastlane
75+
#
76+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
77+
# screenshots whenever they are needed.
78+
# For more information about the recommended setup visit:
79+
# https://docs.fastlane.tools/best-practices/source-control/
80+
81+
**/fastlane/report.xml
82+
**/fastlane/Preview.html
83+
**/fastlane/screenshots
84+
**/fastlane/test_output
85+
86+
# Bundle artifact
87+
*.jsbundle
88+
89+
# Ruby / CocoaPods
90+
**/Pods/
91+
/vendor/bundle/
92+
93+
# Temporary files created by Metro to check the health of the file watcher
94+
.metro-health-check*
95+
96+
# testing
97+
/coverage
98+
99+
# Yarn
100+
.yarn/*
101+
!.yarn/patches
102+
!.yarn/plugins
103+
!.yarn/releases
104+
!.yarn/sdks
105+
!.yarn/versions

.yarn/releases/yarn-3.6.4.cjs

Lines changed: 874 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-3.6.4.cjs

examples.dhall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let conf = ./spago.dhall
22

33
in conf // {
4-
sources = conf.sources # [ "examples/**/*.purs" ],
4+
sources = conf.sources # [ "examples/App/*.purs" ],
55
dependencies = conf.dependencies # [ "httpure" , "affjax", "affjax-web", "node-fs-aff", "js-timers", "web-storage"]
66
}

examples/App/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native',
4+
};

examples/App/.gitignore

Whitespace-only changes.

examples/App/.prettierrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: false,
5+
singleQuote: true,
6+
trailingComma: 'all',
7+
};

examples/App/.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

examples/App/App.purs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
module Examples.App.Main where
2+
3+
import Prelude
4+
5+
import Data.Maybe (Maybe(..))
6+
import Data.Tuple (Tuple)
7+
import Effect (Effect)
8+
import Effect.Aff (Aff)
9+
import Effect.Class (liftEffect)
10+
import Effect.Random as ER
11+
import Flame (AppId(..), Html, (:>))
12+
import Flame.Application.Native as FAN
13+
import Flame.Native.Attribute as HA
14+
import Flame.Native.Element as HE
15+
16+
type Model = Maybe Int
17+
18+
init Model
19+
init = Nothing
20+
21+
data Message = Roll | Update Int
22+
23+
update Model Message Tuple Model (Array (Aff (Maybe Message)))
24+
update model = case _ of
25+
Roll → model :>
26+
[ Just <<< Update <$> liftEffect (ER.randomInt 1 6)
27+
]
28+
Update int → Just int :> []
29+
30+
view Model Html Message
31+
view model = HE.text (show model)
32+
33+
-- HE.div "main"
34+
-- [ HE.text (show model)
35+
-- -- , HE.button [ HA.onClick Roll ] "Roll"
36+
-- ]
37+
38+
main Effect Unit
39+
main = FAN.mount "App"
40+
{ init: init :> []
41+
, subscribe: []
42+
, update
43+
, view
44+
}
45+

examples/App/App.tsx

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/**
2+
* Sample React Native App
3+
* https://github.com/facebook/react-native
4+
*
5+
* @format
6+
*/
7+
8+
import React from 'react';
9+
import type {PropsWithChildren} from 'react';
10+
import {
11+
SafeAreaView,
12+
ScrollView,
13+
StatusBar,
14+
StyleSheet,
15+
Text,
16+
useColorScheme,
17+
View,
18+
} from 'react-native';
19+
20+
import {
21+
Colors,
22+
DebugInstructions,
23+
Header,
24+
LearnMoreLinks,
25+
ReloadInstructions,
26+
} from 'react-native/Libraries/NewAppScreen';
27+
28+
type SectionProps = PropsWithChildren<{
29+
title: string;
30+
}>;
31+
32+
function Section({children, title}: SectionProps): React.JSX.Element {
33+
const isDarkMode = useColorScheme() === 'dark';
34+
return (
35+
<View style={styles.sectionContainer}>
36+
<Text
37+
style={[
38+
styles.sectionTitle,
39+
{
40+
color: isDarkMode ? Colors.white : Colors.black,
41+
},
42+
]}>
43+
{title}
44+
</Text>
45+
<Text
46+
style={[
47+
styles.sectionDescription,
48+
{
49+
color: isDarkMode ? Colors.light : Colors.dark,
50+
},
51+
]}>
52+
{children}
53+
</Text>
54+
</View>
55+
);
56+
}
57+
58+
function App(): React.JSX.Element {
59+
const isDarkMode = useColorScheme() === 'dark';
60+
61+
const backgroundStyle = {
62+
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
63+
};
64+
65+
return (
66+
<SafeAreaView style={backgroundStyle}>
67+
<StatusBar
68+
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
69+
backgroundColor={backgroundStyle.backgroundColor}
70+
/>
71+
<ScrollView
72+
contentInsetAdjustmentBehavior="automatic"
73+
style={backgroundStyle}>
74+
<Header />
75+
<View
76+
style={{
77+
backgroundColor: isDarkMode ? Colors.black : Colors.white,
78+
}}>
79+
<Section title="Step One">
80+
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
81+
screen and then come back to see your edits.
82+
</Section>
83+
<Section title="See Your Changes">
84+
<ReloadInstructions />
85+
</Section>
86+
<Section title="Debug">
87+
<DebugInstructions />
88+
</Section>
89+
<Section title="Learn More">
90+
Read the docs to discover what to do next:
91+
</Section>
92+
<LearnMoreLinks />
93+
</View>
94+
</ScrollView>
95+
</SafeAreaView>
96+
);
97+
}
98+
99+
const styles = StyleSheet.create({
100+
sectionContainer: {
101+
marginTop: 32,
102+
paddingHorizontal: 24,
103+
},
104+
sectionTitle: {
105+
fontSize: 24,
106+
fontWeight: '600',
107+
},
108+
sectionDescription: {
109+
marginTop: 8,
110+
fontSize: 18,
111+
fontWeight: '400',
112+
},
113+
highlight: {
114+
fontWeight: '700',
115+
},
116+
});
117+
118+
export default App;

0 commit comments

Comments
 (0)