Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: android support for clipToBounds #9508

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

Merged
merged 5 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions apps/ui/src/issues/issue-7469-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let loaded = false;
let isIn1 = false;

function updateVcToggleText() {
vcToggle.text = `Container is${reusableItem.reusable ? ' ' : ' NOT '}Reusable`
vcToggle.text = `Container is${reusableItem.reusable ? ' ' : ' NOT '}Reusable`;
}

export function pageLoaded(args) {
Expand Down Expand Up @@ -82,7 +82,7 @@ export function makeReusable(args: EventData) {
}
(args.object as any).___reusableRan = true;
(args.object as any).reusable = true;
if(args.object === reusableItem) {
if (args.object === reusableItem) {
updateVcToggleText();
}
}
Expand Down
14 changes: 2 additions & 12 deletions packages/core/ui/layouts/layout-base.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,8 @@ export class LayoutBase extends LayoutBaseCommon {
return true;
}
[clipToBoundsProperty.setNative](value: boolean) {
// TODO: Use ClipRectangle if API > 16!

// We can't implement this without calling setClipChildren(false) on every ancestor up in the visual tree,
// which will kill performance. It will also lead to unwanted side effects such as other totally unrelated
// views being affected by setting the parents' setClipChildren to false.
// The problem in Android is that a ViewGroup either clips ALL of its children or it does not. Unlike iOS, the clipping
// cannot be controlled on a per view basis. So clipToBounds=false will have to be somehow achieved with stacking different
// views on top of one another in an AbsoluteLayout or GridLayout. There is always a workaround when playing with layouts.
//
// The following article explains this in detail:
// http://stackoverflow.com/questions/25044085/when-drawing-outside-the-view-clip-bounds-with-android-how-do-i-prevent-underli
console.warn(`clipToBounds with value false is not supported on Android. You can use this.android.getParent().setClipChildren(false) as an alternative`);
(<any>this.nativeViewProtected).setClipToBounds(value);

}

[isPassThroughParentEnabledProperty.setNative](value: boolean) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/ui/text-base/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ export class TextBase extends TextBaseCommon {
[paddingLeftProperty.setNative](value: CoreTypes.LengthType) {
org.nativescript.widgets.ViewHelper.setPaddingLeft(this.nativeTextViewProtected, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderLeftWidth, 0));
}

[accessibilityIdentifierProperty.setNative](value: string): void {
// we override the default setter to apply it on nativeTextViewProtected
const id = Utils.ad.resources.getId(':id/nativescript_accessibility_id');
Expand Down
5 changes: 5 additions & 0 deletions packages/ui-mobile-base/android/widgets/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ def computeTargetSdkVersion() {
}
}


android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion computeCompileSdkVersion()
buildToolsVersion computeBuildToolsVersion()

Expand Down
Loading