Checkout my climbing app - Climb Dojo app, which I wrote using this boilerplate.
-
Uses
react-platformula
, which makes writing cross-platform easy
import React, { Component } from 'react';
import Text from 'react-platformula/text';
export default class HelloWorld extends Component {
render() {
return (
<Text>
Hello World
</Text>
);
}
}
import React, { Component } from 'react';
import Block from 'react-platformula/block';
import { getCustom as getCustomText } from 'react-platformula/text';
import punkFontFamily from './punk-font.ttf';
import lightTap from './light-tap.mp3';
import getCustomSmiley from './smiley.svg';
const CustomText = getCustomText({
fontFamily: punkFontFamily,
fontSize: 30,
color: 'red',
});
const CustomSmiley = getCustomSmiley({
width: 20,
height: 20,
fill: 'blue',
});
export default class Button extends Component {
handlePress() {
lightTap.play();
}
render() {
const { text } = this.props;
return (
<Block onPress={() => this.handlePress()}>
<CustomSmiley />
<CustomText>
Click me for sound
</CustomText>
</Block>
);
}
}
- Make sure you installed
react-native
's dependencies (such as java, xcode) check their tutorial if needed. - run
npm i
(oryarn
). - You are now ready to use the boilerplate!
to make it your own do the fellowing steps- Change
app.json
name and display name. - Change registered component name too in
src/index.js
. - If you need to keep the ejected projects (some libraries linking is manual 😩), just remove them from
.gitignore
file.
- Change
npm start, npm run start:web
- Start website on localhost:8090.npm run start:android
- Install and start on android.npm run start:ios
- Install and start on ios.npm run serve:android
- Start packager for android, if no need to install.npm run serve:ios
- Start packager for ios, if no need to install.npm run lint[:report][:error][:fix]
- Run lints usings eslint, recommand to install eslint-plugin on your editor.npm run test[:watch]
- Run unit tests, usesjest
.npm run create:android:release
- Create release APK.npm run build[:web][:ios][:android]
- To make a minified build, needed for web and ios. As for android it is already used withincreate:android:release
.