Skip to content

Commit

Permalink
Merge pull request #1360 from flexn-io/fix/update_react-native-gestur…
Browse files Browse the repository at this point in the history
…e-handler_and_bring_back_default_settings

Fix/update react native gesture handler and bring back default settings
  • Loading branch information
Marius456 committed Jan 25, 2024
2 parents de1e4a9 + b77a0ca commit 86fa250
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 44 deletions.
1 change: 1 addition & 0 deletions packages/core/src/plugins/index.ts
Expand Up @@ -707,6 +707,7 @@ export const overrideFileContents = (dest: string, override: Record<string, stri
);
}
});
console.log(foundRegEx, 'foundRegEx')
if (!foundRegEx) {
if (overridePath !== 'REACT_CORE_OVERRIDES') {
// We only warn against user defined overrides.
Expand Down
Expand Up @@ -127,7 +127,7 @@ dependencies {
} else {
implementation jscFlavor
}
{{PLUGIN_IMPLEMENTATIONS}}

}

apply from: file("{{PATH_REACT_NATIVE_CLI_ANDROID}}/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Expand Down
Expand Up @@ -5,25 +5,20 @@ import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate

{{PLUGIN_ACTIVITY_IMPORTS}}

/**
* Created by ReNative (https://renative.org)
*/

class MainActivity : ReactActivity() {
/**


/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "RnDiffApp"
override fun getMainComponentName(): String = "RNVApp"

/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)

{{PLUGIN_ACTIVITY_METHODS}}
}
}
@@ -1,6 +1,5 @@
package {{APPLICATION_ID}}

import {{APPLICATION_ID}}.BuildConfig

import android.app.Application
import com.facebook.react.PackageList
Expand All @@ -14,22 +13,18 @@ import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.flipper.ReactNativeFlipper
import com.facebook.soloader.SoLoader

{{PLUGIN_IMPORTS}}
class MainApplication : Application(), ReactApplication {

/**
* Created by ReNative (https://renative.org)
*/
override val reactNativeHost: ReactNativeHost =

class MainApplication : Application(), ReactApplication {
override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}

override fun getJSMainModuleName(): String = "{{ENTRY_FILE}}"
override fun getJSMainModuleName(): String = "index"

override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

Expand All @@ -42,13 +37,13 @@ override val reactNativeHost: ReactNativeHost =

override fun onCreate() {
super.onCreate()
{{PLUGIN_DEBUG_SERVER}}

SoLoader.init(this, false)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
{{PLUGIN_ON_CREATE}}
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
}
}
}

Expand Up @@ -2,12 +2,6 @@
"overrides": {
"build/tools/listIOSDevices.js": {
"rawOutput.filter(device => !device.platform.includes('appletv') && !device.platform.includes('macos')).sort(device => device.simulator ? 1 : -1).map(device => {": "rawOutput.sort(device => device.simulator ? 1 : -1).map(device => { // <= PATCHED BY RENATIVE"
},
"build/tools/findMatchingSimulator.js": {
"if (!version.includes('iOS')) {": "if (!version.includes('iOS') && !version.includes('tvOS')) { // <= PATCHED BY RENATIVE"
},
"build/commands/runIOS/index.js": {
"if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, modifiedArgs);": "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, modifiedArgs, device); // <= PATCHED BY RENATIVE"
}
}
}
}
24 changes: 11 additions & 13 deletions packages/sdk-android/src/kotlinParser.ts
Expand Up @@ -60,11 +60,15 @@ export const parseMainApplicationSync = (c: Context) => {
const javaPackageArray = appId?.split('.') || [];

const javaPackagePath = `app/src/main/java/${javaPackageArray.join('/')}`;
mkdirSync(path.join(appFolder, javaPackagePath), { recursive: true });
console.log(javaPackageArray, 'javaPackageArray');
console.log(javaPackagePath, 'javaPackagePath');
// mkdirSync(path.join(appFolder, javaPackagePath), { recursive: true });

const templatePath = 'app/src/main/java/rnv_template/MainApplication.kt';
const applicationPath = `${javaPackagePath}/MainApplication.java`;
// const applicationPath = `${javaPackagePath}/MainApplication.java`;
const bundleAssets = getConfigProp(c, platform, 'bundleAssets');
console.log(templatePath, 'templatePath');

const bundleDefault = JS_BUNDLE_DEFAULTS[platform];
const bundleFile: string =
getGetJsBundleFile(c, platform) || bundleAssets
Expand Down Expand Up @@ -111,7 +115,7 @@ export const parseMainApplicationSync = (c: Context) => {

writeCleanFile(
getBuildFilePath(c, platform, templatePath),
path.join(appFolder, applicationPath),
path.join(appFolder, templatePath),
injects,
undefined,
c
Expand All @@ -123,14 +127,9 @@ export const parseMainActivitySync = (c: RnvContext) => {
const { platform } = c;

const appId = getAppId(c, c.platform);
// console.log('appId', appId);
const javaPackageArray = appId?.split('.') || [];

const javaPackagePath = `app/src/main/java/${javaPackageArray.join('/')}`;
mkdirSync(path.join(appFolder, javaPackagePath), { recursive: true });

const templatePath = 'app/src/main/java/rnv_template/MainActivity.kt';
const activityPath = `${javaPackagePath}/MainActivity.java`;


const templateAndroid = getConfigProp(c, platform, 'templateAndroid', {});

Expand Down Expand Up @@ -167,7 +166,7 @@ export const parseMainActivitySync = (c: RnvContext) => {

writeCleanFile(
getBuildFilePath(c, platform, templatePath),
path.join(appFolder, activityPath),
path.join(appFolder, templatePath),
injects,
undefined,
c
Expand All @@ -178,10 +177,9 @@ export const parseSplashActivitySync = (c: Context) => {
const appFolder = getAppFolder(c);
const { platform } = c;
const appId = getAppId(c, c.platform);
const javaPackageArray = appId?.split('.') || [];


const splashTemplatePath = 'app/src/main/java/rnv_template/SplashActivity.kt';
const splashPath = `app/src/main/java/${javaPackageArray.join('/')}/SplashActivity.java`;

// TODO This is temporary ANDROIDX support. whole kotlin parser will be refactored in the near future
const enableAndroidX = getConfigProp(c, platform, 'enableAndroidX', true);
Expand All @@ -205,7 +203,7 @@ export const parseSplashActivitySync = (c: Context) => {

writeCleanFile(
getBuildFilePath(c, platform, splashTemplatePath),
path.join(appFolder, splashPath),
path.join(appFolder, splashTemplatePath),
injects,
undefined,
c
Expand Down
Expand Up @@ -2,5 +2,6 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-{{INJECT_GRADLE_WRAPPER_VERSION}}-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion packages/template-starter/Gemfile
Expand Up @@ -4,5 +4,5 @@ source 'https://rubygems.org'
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.13'
gem 'activesupport', '~> 7.0', '<= 7.0.8'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'

3 changes: 2 additions & 1 deletion packages/template-starter/renative.json
Expand Up @@ -145,7 +145,8 @@
"react-dom": "source:rnv",
"react-native-gesture-handler": {
"version": "2.14.1",
"disablePluginTemplateOverrides": false
"disablePluginTemplateOverrides": true

},
"@react-native-community/cli-platform-ios": {
"version": "11.3.7",
Expand Down

0 comments on commit 86fa250

Please sign in to comment.