Commit a658579b authored by norhalimah's avatar norhalimah

updating.....

parent b736426d
......@@ -18,8 +18,7 @@ import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
......@@ -29,7 +28,8 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// Packages that cannot be autolinked yet can be added manually here, for
// example:
// packages.add(new MyReactNativePackage());
return packages;
}
......@@ -53,24 +53,23 @@ public class MainApplication extends Application implements ReactApplication {
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
* Loads Flipper in React Native templates. Call this in the onCreate method
* with something like initializeFlipper(this,
* getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
private static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
* We use reflection here to pick up the class that initializes Flipper, since
* Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.pianoapp.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
aClass.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class).invoke(null, context,
reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
......
......@@ -9,13 +9,14 @@ import {
TouchableOpacity,
StyleSheet,
ScrollView,
Image,
} from 'react-native';
import {Icon} from 'react-native-elements';
import Orientation from 'react-native-orientation';
class Home extends React.PureComponent {
componentDidMount() {
async componentDidMount() {
Orientation.lockToPortrait();
}
......@@ -34,26 +35,26 @@ class Home extends React.PureComponent {
}}>
<SafeAreaView>
<ScrollView>
<View style={{marginTop: '10%'}}>
<View style={{marginTop: '5%', marginBottom: '5%'}}>
<TouchableOpacity
style={styles.menu}
onPress={() => {
this.props.navigation.navigate('2',{c: 0, w: 0, t: 0, cc : 1});
}}>
<Icon raised name="trophy" type="font-awesome" />
<Text>Piano</Text>
<Image style={{height:150, width:250}} source={require('../img/1piano.png')} />
<Text style={{fontSize:20}}>{'\n'}Piano</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.menu}
onPress={() => this.props.navigation.navigate('3')}>
<Icon raised name="clipboard" type="font-awesome" />
<Text>Records</Text>
<Icon size={150} name="clipboard" type="font-awesome" />
<Text style={{fontSize:20}}>{'\n'}Records</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.menu}
onPress={() => this.props.navigation.navigate('4')}>
<Icon raised name="cogs" type="font-awesome" />
<Text>Settings</Text>
<Image style={{height:150, width:150}} source={require('../img/settings.png')} />
<Text style={{fontSize:20}}>{'\n'}Settings</Text>
</TouchableOpacity>
</View>
</ScrollView>
......@@ -73,13 +74,12 @@ const styles = StyleSheet.create({
justifyContent: 'center',
},
menu: {
marginTop: '3%',
marginBottom: '2%',
alignItems: 'center',
justifyContent: 'center',
padding: '15%',
marginLeft: '5%',
marginRight: '5%',
padding: '10%',
marginLeft: '3%',
marginRight: '3%',
borderRadius: 10,
borderWidth: 2,
borderColor: 'white',
......
......@@ -18,7 +18,7 @@ import Orientation from 'react-native-orientation';
//import AsyncStorage from '@react-native-async-storage/async-storage';
import * as RNFS from 'react-native-fs';
var path = RNFS.DocumentDirectoryPath + '/test.txt';
var array = [];
//var array = [];
class LogBook extends React.PureComponent {
constructor(props) {
......@@ -35,20 +35,7 @@ class LogBook extends React.PureComponent {
this.setState({
logbook: res.split('\n'),
});
// var l = this.state.logbook.length;
//console.log(res);
// console.log(this.state.logbook);
let index = -1;
array = this.state.logbook;
// console.log(array);
if ((index = array.indexOf('')) !== -1) {
array.splice(index, 1);
this.setState({
logbook: array,
});
console.log(this.state.logbook);
}
// console.log(this.state.logbook.length);
})
.catch((err) => {
console.log(err.message, err.code);
......@@ -73,22 +60,18 @@ class LogBook extends React.PureComponent {
<ScrollView
style={{
marginTop: 50,
marginLeft: 5,
marginRight: 5,
}}>
{this.state.logbook.map((item, id) => (
<View
key={id}
style={{
flexDirection: 'row',
marginBottom: 10,
padding: 15,
borderWidth: 2,
borderColor: 'black',
backgroundColor: 'white',
borderRadius: 10,
borderBottomWidth:1,
}}>
<Text style={{fontSize:15}}>{item.split(',').join('\n')}</Text>
<Text style={{fontSize:17}}>{item.split(',').join('\n')}</Text>
</View>
)).reverse()}
</ScrollView>
......
This diff is collapsed.
/* eslint-disable prettier/prettier */
/*This is an Example of Calling Other Class Function in React Native*/
import { Component } from 'react';
import {Alert} from 'react-native';
import moment from 'moment';
import * as RNFS from 'react-native-fs';
const date = moment().utcOffset('+08:00').format('D MMM YYYY');
const time = moment().utcOffset('+08:00').format('h:mm a');
const record = RNFS.DocumentDirectoryPath + '/test.txt';
class OtherClass extends Component {
functionWithoutArg = () => {
//function to be called from default class (without args)
Alert.alert('Function Called Without Argument ');
};
functionWithArg = (Value) => {
//function to called from default class (with args)
Alert.alert(Value);
};
saveRecord = async (correct, wrong, stime) => {
let obj = {
correct: correct,
wrong: wrong,
timer: stime,
date: date,
time: time,
};
if (await RNFS.exists(record)) {
console.log('BLAH EXISTS');
// write the file
RNFS.appendFile(
record,
'Correct : ' +
JSON.stringify(obj.correct) +
',' +
'Wrong : ' +
JSON.stringify(obj.wrong) +
',' +
'Timer : ' +
stime +
',' +
'Date : ' +
date +
',' +
'Time : ' +
time +
'\n',
'utf8',
)
.then((success) => {
console.log(JSON.stringify(obj));
})
.catch((err) => {
console.log(err.message);
});
} else {
console.log('BLAH DOES NOT EXIST');
RNFS.writeFile(
record,
'Correct : ' +
JSON.stringify(obj.correct) +
',' +
'Wrong : ' +
JSON.stringify(obj.wrong) +
',' +
'Timer : ' +
stime +
',' +
'Date : ' +
date +
',' +
'Time : ' +
time +
'\n',
'utf8',
)
.then((success) => {
console.log(JSON.stringify(obj));
})
.catch((err) => {
console.log(err.message);
});
}
};
}
export default OtherClass;
......@@ -11,23 +11,16 @@ import {
Image,
ScrollView,
Dimensions,
// TextInput,
} from 'react-native';
import Orientation from 'react-native-orientation';
import Notes from './data';
import * as RNFS from 'react-native-fs';
import Counter from 'react-native-counters';
import Feather from 'react-native-vector-icons/Feather';
import NumericInput from 'react-native-numeric-input';
var path = RNFS.DocumentDirectoryPath + '/settings.txt';
var path1 = RNFS.DocumentDirectoryPath + '/counter.txt';
const minusIcon = (isDisabled) => {
return <Feather name="minus" size={20} color={'black'} />;
};
const plusIcon = (isPlusDisabled) => {
return <Feather name="plus" size={20} color={'black'} />;
};
const config = {
deviceWidth: Dimensions.get('window').width,
......@@ -37,6 +30,12 @@ const note = [];
var counter = 0;
export default class Settings extends React.Component {
constructor(props) {
super(props);
this.state = {
value: 0,
};
}
toggleKeyword = (keyword) => {
let list = note;
let index = -1;
......@@ -134,18 +133,22 @@ export default class Settings extends React.Component {
marginRight: config.deviceWidth * 0.1, flexDirection: 'row',
flexWrap: 'wrap'}}>
<Text style={{fontSize: 15,marginRight:5}}>No. of Questions : </Text>
<Counter start={0}
buttonStyle={{
borderColor: '#333',
borderWidth: 2,
}}
countTextStyle={{
color: '#333',
}}
minusIcon={minusIcon}
plusIcon={plusIcon}
<NumericInput
value={this.state.value}
minValue={0}
maxValue={100}
onChange={this.onChange.bind(this)}
/>
onLimitReached={(isMax,msg) => console.log(isMax,msg)}
totalWidth={150}
totalHeight={40}
iconSize={25}
step={1}
valueType="real"
rounded
textColor="black"
iconStyle={{ color: 'white' }}
rightButtonBackgroundColor="black"
leftButtonBackgroundColor="black"/>
</View>
<ScrollView style={{marginTop: '5%', marginBottom : '20%'}}>
<View
......@@ -165,7 +168,7 @@ export default class Settings extends React.Component {
: styles.buttonStyle
}
onPress={() => this.toggleKeyword(item.name)}
key={id}>
key={id} activeOpacity={1.0}>
<Image
source={item.image}
style={{
......@@ -211,7 +214,6 @@ const styles = StyleSheet.create({
flex: 1,
width: config.deviceWidth * 0.4,
alignItems: 'center',
backgroundColor: '#EEA1E1',
borderWidth: 1,
borderColor: 'black',
borderRadius: 10,
......
......@@ -6,6 +6,7 @@ export default StyleSheet.create({
height: '70%',
alignItems: 'center',
borderColor: 'black',
marginTop:5,
},
cc1: {
flexDirection: 'row',
......@@ -55,36 +56,39 @@ export default StyleSheet.create({
marginTop: config.deviceWidth * 0.1,
},
correct: {
width: 65,
width: 100,
textAlign: 'center',
paddingTop: 15,
color: 'black',
height: 70,
height: 60,
borderRadius: 10,
alignItems: 'center',
fontSize: 15,
fontSize: 25,
marginRight: 10,
backgroundColor:'green',
},
wrong: {
width: 65,
height: 70,
width: 100,
height: 60,
borderRadius: 10,
alignItems: 'center',
textAlign: 'center',
paddingTop: 15,
color: 'black',
fontSize: 15,
fontSize: 25,
marginRight: 10,
backgroundColor:'red',
},
timer: {
width: 65,
height: 70,
height: 60,
borderRadius: 10,
alignItems: 'center',
textAlign: 'center',
paddingTop: 16,
color: 'black',
fontSize: 15,
color: 'white',
fontSize: 25,
backgroundColor:'black',
},
submit: {
width: '40%',
......
......@@ -2426,11 +2426,6 @@ dayjs@^1.8.15:
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.9.6.tgz#6f0c77d76ac1ff63720dd1197e5cb87b67943d70"
integrity sha512-HngNLtPEBWRo8EFVmHFmSXAjtCX8rGNqeXQI0Gh7wCTSqwaKgPIDqu9m07wABVopNwzvOeCb+2711vQhDlcIXw==
debounce@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.0.tgz#44a540abc0ea9943018dc0eaa95cce87f65cd131"
integrity sha512-mYtLl1xfZLi1m4RtQYlZgJUNQjl4ZxVnHzIR8nLLgi4q1YT8o/WM+MK/f8yfcc9s5Ir5zRaPZyZU6xs1Syoocg==
debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
......@@ -5847,7 +5842,7 @@ prompts@^2.0.1:
kleur "^3.0.3"
sisteransi "^1.0.5"
prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2:
prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
......@@ -5949,13 +5944,6 @@ react-native-fs@^2.16.6:
base-64 "^0.1.0"
utf8 "^3.0.0"
react-native-full-screen@^0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/react-native-full-screen/-/react-native-full-screen-0.0.3.tgz#00c954f44577527afededfa2a42f6817b5d12891"
integrity sha512-t30Es2jgRR/FPZuXirWRnyhkRYuaZ+WC6SQNj57DYhEJ1tIwLfVRiqdoPxJcpVLFicOmeXHius86CJ2uuDJT8w==
dependencies:
debounce "^1.0.0"
react-native-gesture-handler@^1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.9.0.tgz#e441b1c0277c3fd4ca3e5c58fdd681e2f0ceddf0"
......@@ -5979,11 +5967,24 @@ react-native-iphone-x-helper@^1.3.0:
resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz#20c603e9a0e765fd6f97396638bdeb0e5a60b010"
integrity sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==
react-native-numeric-input@^1.8.3:
version "1.8.3"
resolved "https://registry.yarnpkg.com/react-native-numeric-input/-/react-native-numeric-input-1.8.3.tgz#e869aa1b60d0c38b92e84e44bb28944f48b4ccd3"
integrity sha512-8MeAgbM4+doAkwjPg7iEA604z4d7krJz9r0755YThldCdIvwWZh5VbtRDHxbkMVQ2Ix5xRujFSn7uQWMtln8RA==
dependencies:
prop-types "^15.6.1"
react-native-pixel-perfect "^1.0.1"
react-native-orientation@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/react-native-orientation/-/react-native-orientation-3.1.3.tgz#d45803841fe94b6cce9acbe904fd5ca191a3711e"
integrity sha512-A0h0E+2f95X4avmhaBG1ZT8WDxBACA/q//JN2eF1E7kq8AJVxt5XDiavv+aSBkBlqFsfF3bIS+T/DB5mXmnxuA==
react-native-pixel-perfect@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/react-native-pixel-perfect/-/react-native-pixel-perfect-1.0.2.tgz#8e6dc97e377caa4bd07f9e584ba438d53c0e25e8"
integrity sha512-0IvYCNkxuQbQC9q4tI+C3i6o38nbx916p7gBRBWuPxDhKBCuTkVV3VukcfW6vtjRlwQm6kwQcF9OtI+yUBt+YA==
react-native-ratings@^7.3.0:
version "7.3.0"
resolved "https://registry.yarnpkg.com/react-native-ratings/-/react-native-ratings-7.3.0.tgz#32e11e4ed944ba8adbbc995d601df3f131619b6f"
......@@ -6019,6 +6020,13 @@ react-native-status-bar-height@^2.5.0:
resolved "https://registry.yarnpkg.com/react-native-status-bar-height/-/react-native-status-bar-height-2.6.0.tgz#b6afd25b6e3d533c43d0fcdcfd5cafd775592cea"
integrity sha512-z3SGLF0mHT+OlJDq7B7h/jXPjWcdBT3V14Le5L2PjntjjWM3+EJzq2BcXDwV+v67KFNJic5pgA26cCmseYek6w==
react-native-stopwatch-timer@^0.0.21:
version "0.0.21"
resolved "https://registry.yarnpkg.com/react-native-stopwatch-timer/-/react-native-stopwatch-timer-0.0.21.tgz#52c39f603e36c538bed3466212b1bfb350ed452f"
integrity sha512-qFFsD85NkBT1nxo32HMGq3XAtQyMC09p9ZDIEuOED2BOxgs0UpWg/FSTA0MmEoIKMyXUwSE5VxEzBaGP3z1HFw==
dependencies:
prop-types "^15.7.2"
react-native-super-grid@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/react-native-super-grid/-/react-native-super-grid-4.0.3.tgz#67ce71c241eb572a4ca92c4b667a053f3ec6a874"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment