Skip to content

Commit

Permalink
✨ Added theme and fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
aminmeshk committed Sep 12, 2020
1 parent 49d2dd9 commit cbb6e65
Show file tree
Hide file tree
Showing 67 changed files with 5,127 additions and 50 deletions.
15 changes: 15 additions & 0 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import AppNavigator from './navigation/AppNavigator';
import * as SplashScreen from 'expo-splash-screen';
import * as Font from 'expo-font';

SplashScreen.preventAutoHideAsync();

const App = () => {
const [fontsLoaded] = Font.useFonts({
shabnam: require('./assets/fonts/Shabnam-FD.ttf'),
'shabnam-bold': require('./assets/fonts/Shabnam-Bold-FD.ttf'),
});

if (fontsLoaded) {
SplashScreen.hideAsync();
} else {
return null;
}

return (
<NavigationContainer>
<AppNavigator />
Expand Down
3 changes: 3 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply from: '../../node_modules/react-native-unimodules/gradle.groovy'

import com.android.build.OutputFile

Expand Down Expand Up @@ -187,6 +188,8 @@ dependencies {

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

addUnimodulesDependencies()

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
Expand Down
49 changes: 24 additions & 25 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gpslinerndemo">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".MainApplication"
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gpslinerndemo">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.App.SplashScreen"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
</application>
</manifest>
Binary file not shown.
Binary file added android/app/src/main/assets/fonts/shabnam.ttf
Binary file not shown.
13 changes: 13 additions & 0 deletions android/app/src/main/java/com/gpslinerndemo/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
package com.gpslinerndemo;

import android.os.Bundle;

import com.facebook.react.ReactActivity;

import expo.modules.splashscreen.SplashScreen;
import expo.modules.splashscreen.SplashScreenImageResizeMode;

public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// SplashScreen.show(...) has to be called after super.onCreate(...)
// Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, false);
}


/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
Expand Down
14 changes: 14 additions & 0 deletions android/app/src/main/java/com/gpslinerndemo/MainApplication.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.gpslinerndemo;

import com.gpslinerndemo.generated.BasePackageList;

import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
Expand All @@ -10,8 +12,14 @@
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Arrays;

import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.SingletonModule;

public class MainApplication extends Application implements ReactApplication {
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), null);

private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
Expand All @@ -26,6 +34,12 @@ protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());

// Add unimodules
List<ReactPackage> unimodules = Arrays.<ReactPackage>asList(
new ModuleRegistryAdapter(mModuleRegistryProvider)
);
packages.addAll(unimodules);
return packages;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.gpslinerndemo.generated;

import java.util.Arrays;
import java.util.List;
import org.unimodules.core.interfaces.Package;

public class BasePackageList {
public List<Package> getPackageList() {
return Arrays.<Package>asList(
new expo.modules.constants.ConstantsPackage(),
new expo.modules.filesystem.FileSystemPackage(),
new expo.modules.font.FontLoaderPackage(),
new expo.modules.imageloader.ImageLoaderPackage(),
new expo.modules.permissions.PermissionsPackage(),
new expo.modules.splashscreen.SplashScreenPackage()
);
}
}
7 changes: 7 additions & 0 deletions android/app/src/main/res/drawable/splashscreen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file was created by '@expo/configure-splash-screen' and some of it's content shouldn't be modified by hand
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splashscreen_background"/>
</layer-list>
5 changes: 5 additions & 0 deletions android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually -->
<color name="splashscreen_background">#FFFFFF</color>
</resources>
17 changes: 10 additions & 7 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
<style name="Theme.App.SplashScreen" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually -->
<item name="android:windowBackground">@drawable/splashscreen</item>
<!-- Customize your splash screen theme here -->
</style>
</resources>
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
}
Expand Down
1 change: 1 addition & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
rootProject.name = 'GPSLineRNDemo'
apply from: '../node_modules/react-native-unimodules/gradle.groovy'; includeUnimodulesProjects()
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
Binary file added assets/fonts/Shabnam-Bold-FD.ttf
Binary file not shown.
Binary file added assets/fonts/Shabnam-FD.ttf
Binary file not shown.
38 changes: 38 additions & 0 deletions native-base-theme/components/Badge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// @flow

import variable from './../variables/platform';

export default (variables /* : * */ = variable) => {
const badgeTheme = {
'.primary': {
backgroundColor: variables.buttonPrimaryBg
},
'.warning': {
backgroundColor: variables.buttonWarningBg
},
'.info': {
backgroundColor: variables.buttonInfoBg
},
'.success': {
backgroundColor: variables.buttonSuccessBg
},
'.danger': {
backgroundColor: variables.buttonDangerBg
},
'NativeBase.Text': {
color: variables.badgeColor,
fontSize: variables.fontSizeBase,
lineHeight: variables.lineHeight - 1,
textAlign: 'center',
paddingHorizontal: 3
},
backgroundColor: variables.badgeBg,
padding: variables.badgePadding,
paddingHorizontal: 6,
alignSelf: 'flex-start',
justifyContent: 'center',
borderRadius: 13.5,
height: 27
};
return badgeTheme;
};
11 changes: 11 additions & 0 deletions native-base-theme/components/Body.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @flow

export default () => {
const bodyTheme = {
flex: 1,
alignItems: 'center',
alignSelf: 'center'
};

return bodyTheme;
};
Loading

0 comments on commit cbb6e65

Please sign in to comment.