Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Android, Fabric): jumping content with native header #2169

Merged
merged 66 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
6b2e6da
Stash current changes with jni setup
kkafar Jun 4, 2024
2a2e1bc
Play around with various ideas
kkafar Jun 5, 2024
5c8fd35
Working PoC
kkafar Jun 7, 2024
581cd7e
Get access to font size!
kkafar Jun 7, 2024
fd86a96
Add missing callsite parameter
kkafar Jun 7, 2024
fd9b32f
Improve PoC by adding font-size param
kkafar Jun 7, 2024
bdfc038
Take font size into consideration
kkafar Jun 7, 2024
1ff7f95
Cleanup custom toolbar
kkafar Jun 7, 2024
29a92f3
Remove native function from ScreenViewManager
kkafar Jun 7, 2024
8b445d8
Partially cleanup package file
kkafar Jun 7, 2024
ed0b6ca
Cleanup C++ code & move implementation back to header file
kkafar Jun 7, 2024
342c27e
Format common/ C++ code
kkafar Jun 7, 2024
7d2c5d8
Add ifdefs for Android implementation
kkafar Jun 7, 2024
5ed1933
Cleanup library entrypoint files
kkafar Jun 7, 2024
aadfe60
Move WEAK_THIS initialization to createViewManagers & ...
kkafar Jun 7, 2024
ecd33f6
Missing code comment & cleaup
kkafar Jun 7, 2024
14b0724
Cleanup shadow nodes
kkafar Jun 7, 2024
9df3744
Remove console log from Screen
kkafar Jun 7, 2024
b74618b
Restore in apps directory
kkafar Jun 7, 2024
1c1f8a0
More cleanup in java files
kkafar Jun 7, 2024
81805f0
Optimize imports
kkafar Jun 7, 2024
f8a251b
Improve signature of getInstance method
kkafar Jun 9, 2024
29f6b16
Improve error message in C++ layer when receiving null instance
kkafar Jun 9, 2024
6997c26
Whitespaces in C++ code
kkafar Jun 9, 2024
f67ba5e
Improve JVM code a bit more, nicer error messages
kkafar Jun 9, 2024
27c6ec9
Remove unnecessary line setting support action bar on Activity
kkafar Jun 9, 2024
35f41b7
Restore compiler warning flags
kkafar Jun 9, 2024
5d9210a
Add static variable for font-unset value & cleanup in loggs
kkafar Jun 9, 2024
5221637
Remove unnecessary library initialization code
kkafar Jun 9, 2024
73e533f
Include fbjni only on Android
kkafar Jun 9, 2024
55418d9
Cleanup imports
kkafar Jun 9, 2024
eb36e66
Setup custom component descriptor for screen stack
kkafar Jun 9, 2024
61c42d1
Add simple LRU cache for headerHeight computation
kkafar Jun 10, 2024
f76a0d9
Use HEADER_HEIGHT_CORRECTION global in custom header config descriptor
kkafar Jun 10, 2024
fcc5415
Handle headerShown: false
kkafar Jun 10, 2024
8ea06ac
Make HeaderHeightCacheEntry private
kkafar Jun 10, 2024
8e3362f
Better naming & rnscreens namespace
kkafar Jun 10, 2024
608a11c
Use initialized empty option instead of uninitialized option as retur…
kkafar Jun 13, 2024
9884e83
Use margin instead of setting header config size
kkafar Jun 13, 2024
699015e
Remove setup wiht screen stack header config component descriptor
kkafar Jun 13, 2024
f465673
Try out setup with setting margin
kkafar Jun 13, 2024
51ebbb7
Go back to padding solution
kkafar Jun 13, 2024
e90f57d
Update frame origin & height manually
kkafar Jun 13, 2024
d3da357
Separate JVM implementation to separate class
kkafar Jun 13, 2024
c3aab0e
Working PoC with padding & keeping header height in node state
kkafar Jun 14, 2024
175f49c
Some comments for JVM implementation part
kkafar Jun 14, 2024
02a58c6
Use std:cref
kkafar Jun 14, 2024
2c42d65
Cleanup example a bit
kkafar Jun 14, 2024
8a638c4
Restore Test42 as default
kkafar Jun 14, 2024
dc73577
Merge branch 'main' into @kkafar/attempt-to-fix-jumping-header
kkafar Jun 14, 2024
fc701ef
Add test header to new App.js
kkafar Jun 14, 2024
cc110c5
Remove leftover showcase code
kkafar Jun 14, 2024
3746958
Rename HeaderCorrectionModes to FrameCorrectionModes & put it behind …
kkafar Jun 16, 2024
e3c2fd8
Add verbose error message
kkafar Jun 16, 2024
8fb2709
Cleanup debug logging
kkafar Jun 16, 2024
5938d56
Make compareFrameSizes inline
kkafar Jun 16, 2024
359bc49
Merge branch 'main' into @kkafar/attempt-to-fix-jumping-header
kkafar Jun 17, 2024
54463b4
Use Float instead of raw float to accomodate for platform differences
kkafar Jun 17, 2024
d31dd00
Merge branch 'main' into @kkafar/attempt-to-fix-jumping-header
kkafar Jun 17, 2024
c5e3c6e
Remove merge artifact: App.js in old localisation
kkafar Jun 17, 2024
184a527
Make comparision equality weak
kkafar Jun 17, 2024
fbda22e
Set padding only if headerConfig child is present
kkafar Jun 17, 2024
cb6fe2b
Handle weird case when title is empty but there is custom font size
kkafar Jun 17, 2024
db138f9
Add comment why 0.01 was chosen as default value for parameter
kkafar Jun 17, 2024
a0d15bb
Revert building example from source
kkafar Jun 18, 2024
4f34895
Revert disabling of headerTopInset
kkafar Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Get access to font size!
  • Loading branch information
kkafar committed Jun 7, 2024
commit 581cd7e2ba5f5e24450d2af56b42245897d916ef
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class RNScreensPackage : TurboReactPackage() {
/**
* @return height of the header
*/
private fun computeDummyLayout(): Float {
private fun computeDummyLayout(fontSize: Int): Float {
kkafar marked this conversation as resolved.
Show resolved Hide resolved
// We need to access window dimensions
val topLevelDecorView = reactContext.get()!!.currentActivity!!.window.decorView

Expand All @@ -102,7 +102,7 @@ class RNScreensPackage : TurboReactPackage() {

this.reactContext = WeakReference(reactContext)
initDummyLayoutContent(reactContext)
computeDummyLayout()
computeDummyLayout(24)

return listOf<ViewManager<*, *>>(
ScreenContainerViewManager(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class RNSScreenComponentDescriptor final
shadowNode.getState());
auto stateData = state->getData();

// We need header config props here! Or... we need to pass some options together with screen!
// const auto &props = *std::static_pointer_cast<const RNSScreenProps>(screenShadowNode.getProps());

// const jni::global_ref<jobject> &fabricUIManager = contextContainer_->at<jni::global_ref<jobject>>("FabricUIManager");

// const jni::
Expand All @@ -51,7 +54,7 @@ class RNSScreenComponentDescriptor final
// We can basically crash here
LOG(ERROR) << "Failed to retrieve env\n";
}
jmethodID computeDummyLayoutID = env->GetMethodID(RNSPACKAGE_REFERENCE, "computeDummyLayout", "()F");
jmethodID computeDummyLayoutID = env->GetMethodID(RNSPACKAGE_REFERENCE, "computeDummyLayout", "(I)F");
if (computeDummyLayoutID == nullptr) {
LOG(ERROR) << "Failed to retrieve computeDummyLayout method ID";
}
Expand Down
Loading