Skip to content

Commit 5727cd4

Browse files
committed
fix: fix to simple app
1 parent 01db006 commit 5727cd4

Some content is hidden

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

48 files changed

+8783
-12487
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Quickly and easily check if your app is multiwindow
66

77
- Android
88

9+
![image](https://github.com/user-attachments/assets/945aac7c-c5a5-42dd-8e50-5527c0ea77d4)
10+
911
## Installation
1012

1113
```sh

example/.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+
};

example/.gitignore

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
ios/.xcode.env.local
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
*.hprof
33+
.cxx/
34+
*.keystore
35+
!debug.keystore
36+
37+
# node.js
38+
#
39+
node_modules/
40+
npm-debug.log
41+
yarn-error.log
42+
43+
# fastlane
44+
#
45+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
46+
# screenshots whenever they are needed.
47+
# For more information about the recommended setup visit:
48+
# https://docs.fastlane.tools/best-practices/source-control/
49+
50+
**/fastlane/report.xml
51+
**/fastlane/Preview.html
52+
**/fastlane/screenshots
53+
**/fastlane/test_output
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# Ruby / CocoaPods
59+
/ios/Pods/
60+
/vendor/bundle/
61+
62+
# Temporary files created by Metro to check the health of the file watcher
63+
.metro-health-check*
64+
65+
# testing
66+
/coverage

example/.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+
};

example/Gemfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
7-
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8-
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9-
gem 'xcodeproj', '< 1.26.0'
6+
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7+
# bound in the template on Cocoapods with next React Native release.
8+
gem 'cocoapods', '>= 1.13', '< 1.15'
9+
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'

example/android/app/build.gradle

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ apply plugin: "com.facebook.react"
88
*/
99
react {
1010
/* Folders */
11-
// The root of your project, i.e. where "package.json" lives. Default is '../..'
12-
// root = file("../../")
13-
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14-
// reactNativeDir = file("../../node_modules/react-native")
15-
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16-
// codegenDir = file("../../node_modules/@react-native/codegen")
17-
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18-
// cliFile = file("../../node_modules/react-native/cli.js")
11+
// The root of your project, i.e. where "package.json" lives. Default is '..'
12+
// root = file("../")
13+
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
14+
// reactNativeDir = file("../node_modules/react-native")
15+
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
16+
// codegenDir = file("../node_modules/@react-native/codegen")
17+
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
18+
// cliFile = file("../node_modules/react-native/cli.js")
1919

2020
/* Variants */
2121
// The list of variants to that are debuggable. For those we're going to
@@ -49,9 +49,6 @@ react {
4949
//
5050
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5151
// hermesFlags = ["-O", "-output-source-map"]
52-
53-
/* Autolinking */
54-
autolinkLibrariesWithApp()
5552
}
5653

5754
/**
@@ -77,9 +74,9 @@ android {
7774
buildToolsVersion rootProject.ext.buildToolsVersion
7875
compileSdk rootProject.ext.compileSdkVersion
7976

80-
namespace "ismultiwindow.example"
77+
namespace "com.example"
8178
defaultConfig {
82-
applicationId "ismultiwindow.example"
79+
applicationId "com.example"
8380
minSdkVersion rootProject.ext.minSdkVersion
8481
targetSdkVersion rootProject.ext.targetSdkVersion
8582
versionCode 1
@@ -110,10 +107,13 @@ android {
110107
dependencies {
111108
// The version of react-native is set by the React Native Gradle Plugin
112109
implementation("com.facebook.react:react-android")
110+
implementation("com.facebook.react:flipper-integration")
113111

114112
if (hermesEnabled.toBoolean()) {
115113
implementation("com.facebook.react:hermes-android")
116114
} else {
117115
implementation jscFlavor
118116
}
119117
}
118+
119+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

example/android/app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
android:icon="@mipmap/ic_launcher"
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:allowBackup="false"
11-
android:theme="@style/AppTheme"
12-
android:supportsRtl="true">
11+
android:theme="@style/AppTheme">
1312
<activity
1413
android:name=".MainActivity"
1514
android:label="@string/app_name"
@@ -22,5 +21,10 @@
2221
<category android:name="android.intent.category.LAUNCHER" />
2322
</intent-filter>
2423
</activity>
24+
<activity android:name="com.ismultiwindow.TransparentActivity"
25+
android:theme="@android:style/Theme.Translucent.NoTitleBar"
26+
android:launchMode="singleTop"
27+
>
28+
</activity>
2529
</application>
2630
</manifest>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.example
2+
3+
import android.content.Intent
4+
import com.facebook.react.ReactActivity
5+
import com.facebook.react.ReactActivityDelegate
6+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
7+
import com.facebook.react.defaults.DefaultReactActivityDelegate
8+
9+
class MainActivity : ReactActivity() {
10+
11+
/**
12+
* Returns the name of the main component registered from JavaScript. This is used to schedule
13+
* rendering of the component.
14+
*/
15+
override fun getMainComponentName(): String = "example"
16+
17+
/**
18+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
19+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
20+
*/
21+
override fun createReactActivityDelegate(): ReactActivityDelegate =
22+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
23+
24+
override fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean) {
25+
super.onMultiWindowModeChanged(isInMultiWindowMode)
26+
// val reactContext = getContext()
27+
// // 네이티브 모듈로 이벤트 전달
28+
// val multiWindowModule = IsMultiWindowModule(reactContext)
29+
// multiWindowModule.onMultiWindowModeChanged(isInMultiWindowMode)
30+
println("example, 다중 창 모드 변경됨 : " + isInMultiWindowMode)
31+
val intent =
32+
Intent("onMultiWindowModeChanged").apply {
33+
putExtra("isInMultiWindowMode", isInMultiWindowMode)
34+
}
35+
sendBroadcast(intent)
36+
}
37+
}

example/android/app/src/main/java/ismultiwindow/example/MainApplication.kt renamed to example/android/app/src/main/java/com/example/MainApplication.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ismultiwindow.example
1+
package com.example
22

33
import android.app.Application
44
import com.facebook.react.PackageList
@@ -9,7 +9,7 @@ import com.facebook.react.ReactPackage
99
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
1010
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
1111
import com.facebook.react.defaults.DefaultReactNativeHost
12-
import com.facebook.react.soloader.OpenSourceMergedSoMapping
12+
import com.facebook.react.flipper.ReactNativeFlipper
1313
import com.facebook.soloader.SoLoader
1414

1515
class MainApplication : Application(), ReactApplication {
@@ -31,14 +31,15 @@ class MainApplication : Application(), ReactApplication {
3131
}
3232

3333
override val reactHost: ReactHost
34-
get() = getDefaultReactHost(applicationContext, reactNativeHost)
34+
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
3535

3636
override fun onCreate() {
3737
super.onCreate()
38-
SoLoader.init(this, OpenSourceMergedSoMapping)
38+
SoLoader.init(this, false)
3939
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
4040
// If you opted-in for the New Architecture, we load the native entry point for this app.
4141
load()
4242
}
43+
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
4344
}
4445
}

example/android/app/src/main/java/ismultiwindow/example/MainActivity.kt

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)