-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from proyecto26/89-add-formsheetpreferredconte…
…ntsize-prop-to-allow-for-custom-sized-formsheet-modals Add custom size option to iOS formSheet Modal
- Loading branch information
Showing
99 changed files
with
6,239 additions
and
25,288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { EventData, Page } from '@nativescript/core'; | ||
import {HelloWorldModel} from './home-view-model'; | ||
import { EventData, Page } from "@nativescript/core"; | ||
import { HelloWorldModel } from "./home-view-model"; | ||
|
||
// Event handler for Page 'loaded' event attached in main-page.xml | ||
export function pageLoaded(args: EventData) { | ||
// Get the event sender | ||
let page = <Page>args.object; | ||
page.bindingContext = new HelloWorldModel(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,116 @@ | ||
import { Observable, Utils, Dialogs } from '@nativescript/core'; | ||
import { InAppBrowser } from 'nativescript-inappbrowser'; | ||
import { getDeepLink, sleep } from './utilities'; | ||
import { Dialogs, Observable, Utils } from "@nativescript/core"; | ||
import { Screen } from "@nativescript/core/platform"; | ||
import { InAppBrowser } from "nativescript-inappbrowser"; | ||
import { getDeepLink, sleep } from "./utilities"; | ||
|
||
export class HelloWorldModel extends Observable { | ||
private _url: string; | ||
private _url: string; | ||
|
||
constructor() { | ||
super(); | ||
constructor() { | ||
super(); | ||
|
||
// Initialize default values. | ||
this._url = 'https://nativescript.org'; | ||
} | ||
|
||
get url(): string { | ||
return this._url; | ||
} | ||
// Initialize default values. | ||
this._url = "https://nativescript.org"; | ||
} | ||
|
||
set url(value: string) { | ||
if (this._url !== value) { | ||
this._url = value; | ||
this.notifyPropertyChange('url', value); | ||
get url(): string { | ||
return this._url; | ||
} | ||
} | ||
|
||
async openLink() { | ||
try { | ||
const { url } = this; | ||
if (await InAppBrowser.isAvailable()) { | ||
const result = await InAppBrowser.open(url, { | ||
// iOS Properties | ||
dismissButtonStyle: 'cancel', | ||
preferredBarTintColor: '#453AA4', | ||
preferredControlTintColor: 'white', | ||
readerMode: false, | ||
animated: true, | ||
modalPresentationStyle: 'fullScreen', | ||
modalTransitionStyle: 'coverVertical', | ||
modalEnabled: true, | ||
enableBarCollapsing: false, | ||
// Android Properties | ||
showTitle: true, | ||
toolbarColor: '#6200EE', | ||
secondaryToolbarColor: 'black', | ||
navigationBarColor: 'black', | ||
navigationBarDividerColor: 'white', | ||
enableUrlBarHiding: true, | ||
enableDefaultShare: true, | ||
forceCloseOnRedirection: true, | ||
// Specify full animation resource identifier(package:anim/name) | ||
// or only resource name(in case of animation bundled with app). | ||
animations: { | ||
startEnter: 'slide_in_right', | ||
startExit: 'slide_out_left', | ||
endEnter: 'slide_in_left', | ||
endExit: 'slide_out_right' | ||
}, | ||
headers: { | ||
'my-custom-header': 'my custom header value' | ||
}, | ||
hasBackButton: true, | ||
browserPackage: '', | ||
showInRecents: false | ||
}); | ||
await sleep(800); | ||
Dialogs.alert({ | ||
title: 'Response', | ||
message: JSON.stringify(result), | ||
okButtonText: 'Ok' | ||
}); | ||
} | ||
else { | ||
Utils.openUrl(url); | ||
} | ||
set url(value: string) { | ||
if (this._url !== value) { | ||
this._url = value; | ||
this.notifyPropertyChange("url", value); | ||
} | ||
} | ||
catch (error) { | ||
Dialogs.alert({ | ||
title: 'Error', | ||
message: error.message, | ||
okButtonText: 'Ok' | ||
}); | ||
|
||
async openLink() { | ||
try { | ||
const { url } = this; | ||
if (await InAppBrowser.isAvailable()) { | ||
const { widthDIPs, heightDIPs } = Screen.mainScreen; | ||
const result = await InAppBrowser.open(url, { | ||
// iOS Properties | ||
dismissButtonStyle: "cancel", | ||
preferredBarTintColor: "#453AA4", | ||
preferredControlTintColor: "white", | ||
readerMode: false, | ||
animated: true, | ||
modalPresentationStyle: "formSheet", | ||
modalTransitionStyle: "coverVertical", | ||
modalEnabled: true, | ||
enableBarCollapsing: false, | ||
formSheetPreferredContentSize: { | ||
width: widthDIPs - widthDIPs / 6, | ||
height: heightDIPs - heightDIPs / 6, | ||
}, | ||
// Android Properties | ||
showTitle: true, | ||
toolbarColor: "#6200EE", | ||
secondaryToolbarColor: "black", | ||
navigationBarColor: "black", | ||
navigationBarDividerColor: "white", | ||
enableUrlBarHiding: true, | ||
enableDefaultShare: true, | ||
forceCloseOnRedirection: true, | ||
// Specify full animation resource identifier(package:anim/name) | ||
// or only resource name(in case of animation bundled with app). | ||
animations: { | ||
startEnter: "slide_in_right", | ||
startExit: "slide_out_left", | ||
endEnter: "slide_in_left", | ||
endExit: "slide_out_right", | ||
}, | ||
headers: { | ||
"my-custom-header": "my custom header value", | ||
}, | ||
hasBackButton: true, | ||
browserPackage: "", | ||
showInRecents: false, | ||
}); | ||
await sleep(800); | ||
Dialogs.alert({ | ||
title: "Response", | ||
message: JSON.stringify(result), | ||
okButtonText: "Ok", | ||
}); | ||
} else { | ||
Utils.openUrl(url); | ||
} | ||
} catch (error) { | ||
Dialogs.alert({ | ||
title: "Error", | ||
message: error.message, | ||
okButtonText: "Ok", | ||
}); | ||
} | ||
} | ||
} | ||
|
||
async tryDeepLinking() { | ||
const loginUrl = `https://proyecto26.github.io/react-native-inappbrowser`; | ||
const redirectUrl = getDeepLink('home'); | ||
const url = `${loginUrl}?redirect_url=${encodeURIComponent(redirectUrl)}`; | ||
try { | ||
if (await InAppBrowser.isAvailable()) { | ||
const result = await InAppBrowser.openAuth(url, redirectUrl, { | ||
// iOS Properties | ||
ephemeralWebSession: true, | ||
// Android Properties | ||
showTitle: false, | ||
enableUrlBarHiding: true, | ||
enableDefaultShare: true | ||
}); | ||
await sleep(800); | ||
Dialogs.alert({ | ||
title: 'Response', | ||
message: JSON.stringify(result), | ||
okButtonText: 'Ok' | ||
}); | ||
} | ||
} catch { | ||
Dialogs.alert('Something’s wrong with the app :('); | ||
async tryDeepLinking() { | ||
const loginUrl = `https://proyecto26.github.io/react-native-inappbrowser`; | ||
const redirectUrl = getDeepLink("home"); | ||
const url = `${loginUrl}?redirect_url=${encodeURIComponent( | ||
redirectUrl | ||
)}`; | ||
try { | ||
if (await InAppBrowser.isAvailable()) { | ||
const result = await InAppBrowser.openAuth(url, redirectUrl, { | ||
// iOS Properties | ||
ephemeralWebSession: true, | ||
// Android Properties | ||
showTitle: false, | ||
enableUrlBarHiding: true, | ||
enableDefaultShare: true, | ||
}); | ||
await sleep(800); | ||
Dialogs.alert({ | ||
title: "Response", | ||
message: JSON.stringify(result), | ||
okButtonText: "Ok", | ||
}); | ||
} | ||
} catch { | ||
Dialogs.alert("Something’s wrong with the app :("); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.